massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / es.string.from-code-point.js
1 var $ = require('../internals/export');
2 var global = require('../internals/global');
3 var uncurryThis = require('../internals/function-uncurry-this');
4 var toAbsoluteIndex = require('../internals/to-absolute-index');
5
6 var RangeError = global.RangeError;
7 var fromCharCode = String.fromCharCode;
8 // eslint-disable-next-line es/no-string-fromcodepoint -- required for testing
9 var $fromCodePoint = String.fromCodePoint;
10 var join = uncurryThis([].join);
11
12 // length should be 1, old FF problem
13 var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1;
14
15 // `String.fromCodePoint` method
16 // https://tc39.es/ecma262/#sec-string.fromcodepoint
17 $({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, {
18   // eslint-disable-next-line no-unused-vars -- required for `.length`
19   fromCodePoint: function fromCodePoint(x) {
20     var elements = [];
21     var length = arguments.length;
22     var i = 0;
23     var code;
24     while (length > i) {
25       code = +arguments[i++];
26       if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point');
27       elements[i] = code < 0x10000
28         ? fromCharCode(code)
29         : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00);
30     } return join(elements, '');
31   }
32 });