MCPcopy
hub / github.com/slevithan/xregexp / codePointToString

Function codePointToString

tools/scripts/utils.js:13–20  ·  view source on GitHub ↗
(codePoint)

Source from the content-addressed store, hash-verified

11const lowSurrogate = (codePoint) => ((codePoint - 0x10000) % 0x400) + 0xDC00;
12
13const codePointToString = (codePoint) => {
14 const string = String.fromCodePoint(codePoint);
15 // Important: escape RegExp meta-characters.
16 if (/[$()*+\-\./?\[\]^{|}]/.test(string)) {
17 return `\\${string}`;
18 }
19 return string;
20};
21
22const createRange = (codePoints) => {
23 // Does the range contain lone high surrogates?

Callers 1

createBmpRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…