|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
735 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var $TypeError = require('es-errors/type');
|
|---|
| 4 |
|
|---|
| 5 | var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint');
|
|---|
| 6 | var IsArray = require('./IsArray');
|
|---|
| 7 |
|
|---|
| 8 | var forEach = require('../helpers/forEach');
|
|---|
| 9 | var isCodePoint = require('../helpers/isCodePoint');
|
|---|
| 10 |
|
|---|
| 11 | // https://262.ecma-international.org/12.0/#sec-codepointstostring
|
|---|
| 12 |
|
|---|
| 13 | module.exports = function CodePointsToString(text) {
|
|---|
| 14 | if (!IsArray(text)) {
|
|---|
| 15 | throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points');
|
|---|
| 16 | }
|
|---|
| 17 | var result = '';
|
|---|
| 18 | forEach(text, function (cp) {
|
|---|
| 19 | if (!isCodePoint(cp)) {
|
|---|
| 20 | throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points');
|
|---|
| 21 | }
|
|---|
| 22 | result += UTF16EncodeCodePoint(cp);
|
|---|
| 23 | });
|
|---|
| 24 | return result;
|
|---|
| 25 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.