.gitignore added
[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 toAbsoluteIndex = require('../internals/to-absolute-index');
3
4 var fromCharCode = String.fromCharCode;
5 var nativeFromCodePoint = String.fromCodePoint;
6
7 // length should be 1, old FF problem
8 var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1;
9
10 // `String.fromCodePoint` method
11 // https://tc39.es/ecma262/#sec-string.fromcodepoint
12 $({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, {
13   // eslint-disable-next-line no-unused-vars -- required for `.length`
14   fromCodePoint: function fromCodePoint(x) {
15     var elements = [];
16     var length = arguments.length;
17     var i = 0;
18     var code;
19     while (length > i) {
20       code = +arguments[i++];
21       if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point');
22       elements.push(code < 0x10000
23         ? fromCharCode(code)
24         : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00)
25       );
26     } return elements.join('');
27   }
28 });