2017-04-20 03:09:25 +02:00
|
|
|
var $export = require('./$.export')
|
|
|
|
, toIndex = require('./$.to-index')
|
2016-10-10 03:43:44 +02:00
|
|
|
, fromCharCode = String.fromCharCode
|
|
|
|
, $fromCodePoint = String.fromCodePoint;
|
|
|
|
|
|
|
|
// length should be 1, old FF problem
|
|
|
|
$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
|
|
|
|
// 21.1.2.2 String.fromCodePoint(...codePoints)
|
|
|
|
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
|
2017-04-20 03:09:25 +02:00
|
|
|
var res = []
|
|
|
|
, $$ = arguments
|
|
|
|
, $$len = $$.length
|
|
|
|
, i = 0
|
2016-10-10 03:43:44 +02:00
|
|
|
, code;
|
2017-04-20 03:09:25 +02:00
|
|
|
while($$len > i){
|
|
|
|
code = +$$[i++];
|
2016-10-10 03:43:44 +02:00
|
|
|
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
|
|
|
|
res.push(code < 0x10000
|
|
|
|
? fromCharCode(code)
|
|
|
|
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
|
|
|
|
);
|
|
|
|
} return res.join('');
|
|
|
|
}
|
|
|
|
});
|