MCPcopy Index your code
hub / github.com/reactjs/react-rails / scanUnicodeCodePointEscape

Function scanUnicodeCodePointEscape

lib/assets/javascripts/JSXTransformer.js:2946–2976  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2944 }
2945
2946 function scanUnicodeCodePointEscape() {
2947 var ch, code, cu1, cu2;
2948
2949 ch = source[index];
2950 code = 0;
2951
2952 // At least, one hex digit is required.
2953 if (ch === '}') {
2954 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2955 }
2956
2957 while (index < length) {
2958 ch = source[index++];
2959 if (!isHexDigit(ch)) {
2960 break;
2961 }
2962 code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
2963 }
2964
2965 if (code > 0x10FFFF || ch !== '}') {
2966 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2967 }
2968
2969 // UTF-16 Encoding
2970 if (code <= 0xFFFF) {
2971 return String.fromCharCode(code);
2972 }
2973 cu1 = ((code - 0x10000) >> 10) + 0xD800;
2974 cu2 = ((code - 0x10000) & 1023) + 0xDC00;
2975 return String.fromCharCode(cu1, cu2);
2976 }
2977
2978 function getEscapedIdentifier() {
2979 var ch, id;

Callers 2

scanStringLiteralFunction · 0.85
scanTemplateFunction · 0.85

Calls 2

throwErrorFunction · 0.85
isHexDigitFunction · 0.85

Tested by

no test coverage detected