UNPKG

@technobuddha/library

Version:
15 lines (14 loc) 487 B
/** * Deterimine is a character is a surrogate * * @param input the character to test * @param __namedParameters see {@link Options} * @default high true * @defaultValue low true * @returns true if the specified character is a unicode surrogate */ export function isSurrogate(input, { high = true, low = true } = {}) { const cc = input.charCodeAt(0); return ((high && cc >= 0xD800 && cc <= 0xDBFF) || (low && cc >= 0xDC00 && cc <= 0xDFFF)); } export default isSurrogate;