MCPcopy Index your code
hub / github.com/formatjs/formatjs / isSurrogate

Function isSurrogate

packages/intl-segmenter/segmentation-utils.ts:14–21  ·  view source on GitHub ↗
(str: string, pos: number)

Source from the content-addressed store, hash-verified

12}
13
14export const isSurrogate = (str: string, pos: number): boolean => {
15 return (
16 0xd800 <= str.charCodeAt(pos - 1) &&
17 str.charCodeAt(pos - 1) <= 0xdbff &&
18 0xdc00 <= str.charCodeAt(pos) &&
19 str.charCodeAt(pos) <= 0xdfff
20 )
21}
22
23// alternative surrogate check mimicking the java implementation
24// const TRAIL_SURROGATE_BITMASK = 0xfffffc00

Callers 1

breaksAtMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected