surrogate-pairs.js 738 B

123456789101112131415
  1. export var fromCodePoint = String.fromCodePoint ||
  2. function (astralCodePoint) {
  3. return String.fromCharCode(Math.floor((astralCodePoint - 0x10000) / 0x400) + 0xd800, ((astralCodePoint - 0x10000) % 0x400) + 0xdc00);
  4. };
  5. // @ts-expect-error - String.prototype.codePointAt might not exist in older node versions
  6. export var 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 + input.charCodeAt(position + 1) - 0xdc00 + 0x10000;
  12. };
  13. export var highSurrogateFrom = 0xd800;
  14. export var highSurrogateTo = 0xdbff;
  15. //# sourceMappingURL=surrogate-pairs.js.map