|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | var $ = require('../internals/export');
|
|---|
| 3 | var uncurryThis = require('../internals/function-uncurry-this');
|
|---|
| 4 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
|---|
| 5 |
|
|---|
| 6 | var $RangeError = 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, arity: 1, 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 new $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 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.