surrogate-pairs.js 668 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.fromCodePoint = String.fromCodePoint || function (astralCodePoint) {
  4. return String.fromCharCode(Math.floor((astralCodePoint - 0x10000) / 0x400) + 0xD800, (astralCodePoint - 0x10000) % 0x400 + 0xDC00);
  5. };
  6. exports.getCodePoint = String.prototype.codePointAt ?
  7. function (input, position) {
  8. return input.codePointAt(position);
  9. } :
  10. function (input, position) {
  11. return (input.charCodeAt(position) - 0xD800) * 0x400
  12. + input.charCodeAt(position + 1) - 0xDC00 + 0x10000;
  13. };
  14. exports.highSurrogateFrom = 0xD800;
  15. exports.highSurrogateTo = 0xDBFF;