MCPcopy Index your code
hub / github.com/deployd/deployd / codePointToSymbol

Function codePointToSymbol

test-app/public/mocha.js:11722–11750  ·  view source on GitHub ↗
(codePoint, strict)

Source from the content-addressed store, hash-verified

11720
11721 // Modified version of `ucs2encode`; see https://mths.be/punycode.
11722 var codePointToSymbol = function(codePoint, strict) {
11723 var output = '';
11724 if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
11725 // See issue #4:
11726 // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
11727 // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
11728 // REPLACEMENT CHARACTER.”
11729 if (strict) {
11730 parseError('character reference outside the permissible Unicode range');
11731 }
11732 return '\uFFFD';
11733 }
11734 if (has(decodeMapNumeric, codePoint)) {
11735 if (strict) {
11736 parseError('disallowed character reference');
11737 }
11738 return decodeMapNumeric[codePoint];
11739 }
11740 if (strict && contains(invalidReferenceCodePoints, codePoint)) {
11741 parseError('disallowed character reference');
11742 }
11743 if (codePoint > 0xFFFF) {
11744 codePoint -= 0x10000;
11745 output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
11746 codePoint = 0xDC00 | codePoint & 0x3FF;
11747 }
11748 output += stringFromCharCode(codePoint);
11749 return output;
11750 };
11751
11752 var hexEscape = function(codePoint) {
11753 return '&#x' + codePoint.toString(16).toUpperCase() + ';';

Callers 1

decodeFunction · 0.85

Calls 3

parseErrorFunction · 0.85
containsFunction · 0.85
hasFunction · 0.70

Tested by

no test coverage detected