source: imaps-frontend/node_modules/es-abstract/2021/CodePointsToString.js

main
Last change on this file 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
RevLine 
[d565449]1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint');
6var IsArray = require('./IsArray');
7
8var forEach = require('../helpers/forEach');
9var isCodePoint = require('../helpers/isCodePoint');
10
11// https://262.ecma-international.org/12.0/#sec-codepointstostring
12
13module.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.