1 var $ = require('../internals/export');
2 var toAbsoluteIndex = require('../internals/to-absolute-index');
4 var fromCharCode = String.fromCharCode;
5 var nativeFromCodePoint = String.fromCodePoint;
7 // length should be 1, old FF problem
8 var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1;
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) {
16 var length = arguments.length;
20 code = +arguments[i++];
21 if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point');
22 elements.push(code < 0x10000
24 : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00)
26 } return elements.join('');