Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

string-character-is-astral-surrogate

codsen115.4kMIT3.0.11TypeScript support: included

Tells, is given character a part of astral character, specifically, a high and low surrogate

astral, character, characters, emoji, high, identify, is, low, string, support, surrogate, surrogates, tell, unicode

readme

string-character-is-astral-surrogate

Tells, is given character a part of astral character, specifically, a high and low surrogate

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 1.13.0 (npm i string-character-is-astral-surrogate@1.13.0).

npm i string-character-is-astral-surrogate

Quick Take

import { strict as assert } from "assert";

import {
  isHighSurrogate,
  isLowSurrogate,
} from "string-character-is-astral-surrogate";

// 🧢 = \uD83E\uDDE2

assert.equal(isHighSurrogate("\uD83E"), true);
// the first character, high surrogate of the cap is indeed a high surrogate

assert.equal(isHighSurrogate("\uDDE2"), false);
// the second character, low surrogate of the cap is NOT a high surrogate

assert.equal(isLowSurrogate("\uD83E"), false);
// the first character, high surrogate of the cap is NOT a low surrogate
// it's a high surrogate

assert.equal(isLowSurrogate("\uDDE2"), true);
// the second character, low surrogate of the cap is indeed a low surrogate

Documentation

Please visit codsen.com for a full description of the API.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License.

Copyright © 2010-2025 Roy Revelt and other contributors.

ok codsen star

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

3.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

2.1.0 (2022-08-12)

Features

2.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

1.13.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

1.12.15 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

1.12.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

1.12.0 (2021-01-23)

Features

1.11.0 (2020-11-28)

Accidental version bump during migration to SourceHut. Sorry about that.

1.10.0 (2019-01-20)

  • Various documentation and setup tweaks after we migrated to monorepo
  • Setup refresh: updated dependencies and all config files using automated tools

1.4.0 (2018-10-25)

  • Update all dependencies
  • Restore coveralls.io reporting
  • Restore unit test linting

1.3.0 (2018-06-16)

  • Tweaks to the setup: added comment removal during Rollup build and dependency updates

1.2.0 (2018-06-16)

GitHub sold us out. In the meantime, we:

  • Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
  • Dropped BitHound (RIP) and Travis

1.1.0 (2018-05-26)

  • Set up Prettier on a custom ESLint rule set.
  • Remove package.lock and .editorconfig
  • Wired Rollup to remove comments from non-dev builds. This means we can now leave the console.logs in the source code — there's no need to comment-out console.log statements or care about them not spilling into production. Now it's done automatically.
  • Unit tests are pointing at ES modules build, which means that code coverage is correct now, without Babel functions being missed. This is important because now code coverage is real again and now there are no excuses not to perfect it.

1.0.0 (2018-03-01)

  • First public release