source: imaps-frontend/node_modules/es-abstract/2023/StringToCodePoints.js@ d565449

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: 678 bytes
RevLine 
[d565449]1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var callBound = require('call-bind/callBound');
6
7var $push = callBound('Array.prototype.push');
8
9var CodePointAt = require('./CodePointAt');
10
11// https://262.ecma-international.org/12.0/#sec-stringtocodepoints
12
13module.exports = function StringToCodePoints(string) {
14 if (typeof string !== 'string') {
15 throw new $TypeError('Assertion failed: `string` must be a String');
16 }
17 var codePoints = [];
18 var size = string.length;
19 var position = 0;
20 while (position < size) {
21 var cp = CodePointAt(string, position);
22 $push(codePoints, cp['[[CodePoint]]']);
23 position += cp['[[CodeUnitCount]]'];
24 }
25 return codePoints;
26};
Note: See TracBrowser for help on using the repository browser.