2017-08-14 05:01:11 +02:00
|
|
|
var $export = require('./_export');
|
|
|
|
var toAbsoluteIndex = require('./_to-absolute-index');
|
|
|
|
var fromCharCode = String.fromCharCode;
|
|
|
|
var $fromCodePoint = String.fromCodePoint;
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
// length should be 1, old FF problem
|
|
|
|
$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
|
|
|
|
// 21.1.2.2 String.fromCodePoint(...codePoints)
|
2017-08-14 05:01:11 +02:00
|
|
|
fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars
|
|
|
|
var res = [];
|
|
|
|
var aLen = arguments.length;
|
|
|
|
var i = 0;
|
|
|
|
var code;
|
|
|
|
while (aLen > i) {
|
2017-05-27 17:36:13 +02:00
|
|
|
code = +arguments[i++];
|
2017-08-14 05:01:11 +02:00
|
|
|
if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
|
2016-10-10 03:43:44 +02:00
|
|
|
res.push(code < 0x10000
|
|
|
|
? fromCharCode(code)
|
|
|
|
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
|
|
|
|
);
|
|
|
|
} return res.join('');
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
});
|