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