main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
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.