UNPKG

string-character-is-astral-surrogate

Version:

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

11 lines (9 loc) 850 B
/** * @name string-character-is-astral-surrogate * @fileoverview Tells, is given character a part of astral character, specifically, a high and low surrogate * @version 3.0.11 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/string-character-is-astral-surrogate/} */ function t(r){if(typeof r=="string")return r.length===0?!1:r.charCodeAt(0)>=55296&&r.charCodeAt(0)<=56319;if(r===void 0)return!1;throw new TypeError(`string-character-is-astral-surrogate/isHighSurrogate(): the input is not string but ${typeof r}`)}function e(r){if(typeof r=="string")return r.length===0?!1:r.charCodeAt(0)>=56320&&r.charCodeAt(0)<=57343;if(r===void 0)return!1;throw new TypeError(`string-character-is-astral-surrogate/isLowSurrogate(): the input is not string but ${typeof r}`)}export{t as isHighSurrogate,e as isLowSurrogate};