MCPcopy Create free account
hub / github.com/es-shims/RegExp.escape / codePointStringToNum

Function codePointStringToNum

implementation.js:17–27  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

15
16var $charCodeAt = callBound('String.prototype.charCodeAt');
17var codePointStringToNum = function codePointStringToNumber(c) {
18 var first = $charCodeAt(c, 0);
19 if (first < 0xD800 || first > 0xDBFF || c.length === 1) {
20 return first;
21 }
22 var second = $charCodeAt(c, 1);
23 if (second < 0xDC00 || second > 0xDFFF) {
24 return first;
25 }
26 return ((first - 0xD800) * 1024) + (second - 0xDC00) + 0x10000;
27};
28
29module.exports = function escape(S) {
30 if (typeof S !== 'string') {

Callers 1

implementation.jsFile · 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…