JSPM

@stdlib/assert-has-utf16-surrogate-pair-at

0.0.8
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1215
  • Score
    100M100P100Q144672F
  • License Apache-2.0

Test if a position in a string marks the start of a UTF-16 surrogate pair.

Package Exports

  • @stdlib/assert-has-utf16-surrogate-pair-at
  • @stdlib/assert-has-utf16-surrogate-pair-at/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stdlib/assert-has-utf16-surrogate-pair-at) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hasUTF16SurrogatePairAt

NPM version Build Status Coverage Status

Test if a position in a string marks the start of a UTF-16 surrogate pair.

Installation

npm install @stdlib/assert-has-utf16-surrogate-pair-at

Usage

var hasUTF16SurrogatePairAt = require( '@stdlib/assert-has-utf16-surrogate-pair-at' );

hasUTF16SurrogatePairAt( string, position )

Tests if a position (in UTF-16 code units) in a string marks the start of a UTF-16 surrogate pair.

var bool = hasUTF16SurrogatePairAt( '🌷', 0 );
// returns true

bool = hasUTF16SurrogatePairAt( '🌷', 1 );
// returns false

Notes

  • Note that position does not refer to a visual character position, but to an index in the ordered sequence of UTF-16 code units.

Examples

var hasUTF16SurrogatePairAt = require( '@stdlib/assert-has-utf16-surrogate-pair-at' );

var bool = hasUTF16SurrogatePairAt( '🌷', 0 );
// returns true

bool = hasUTF16SurrogatePairAt( '🌷', 1 );
// returns false

CLI

Installation

To use the module as a general utility, install the module globally

npm install -g @stdlib/assert-has-utf16-surrogate-pair-at

Usage

Usage: has-utf16-surrogate-pair-at [options] [<string>] --pos=<index>

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.
         --pos index           Position in string.

Examples

$ has-utf16-surrogate-pair-at --pos=0 🌷
true

To use as a standard stream,

$ echo -n '🌷' | has-utf16-surrogate-pair-at --pos=1
false

Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright © 2016-2022. The Stdlib Authors.