web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
779 B

  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = unesc;
  4. var whitespace = '[\\x20\\t\\r\\n\\f]';
  5. var unescapeRegExp = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig');
  6. function unesc(str) {
  7. return str.replace(unescapeRegExp, function (_, escaped, escapedWhitespace) {
  8. var high = '0x' + escaped - 0x10000; // NaN means non-codepoint
  9. // Workaround erroneous numeric interpretation of +"0x"
  10. // eslint-disable-next-line no-self-compare
  11. return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint
  12. String.fromCharCode(high + 0x10000) : // Supplemental Plane codepoint (surrogate pair)
  13. String.fromCharCode(high >> 10 | 0xd800, high & 0x3ff | 0xdc00);
  14. });
  15. }
  16. module.exports = exports.default;