/
lostSun
/
project-client-server-apps
Обзор
Документация
Войти
/
lostSun
/
project-client-server-apps
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/es-abstract/2024/IsStringWellFormedUnicode.js
23 строки
631 B
1lostsun
initial commit
05 май 2025, 11:35
05 май 2025, 11:35
fe8f535
Код
Авторство
О чём код?
'use strict'; var CodePointAt = require('./CodePointAt'); var $TypeError = require('es-errors/type'); // https://262.ecma-international.org/14.0/#sec-isstringwellformedunicode module.exports = function IsStringWellFormedUnicode(string) { if (typeof string !== 'string') { throw new $TypeError('Assertion failed: `string` must be a String'); } var len = string.length; // step 1 var k = 0; // step 2 while (k < len) { // step 3 var cp = CodePointAt(string, k); // step 3.a if (cp['[[IsUnpairedSurrogate]]']) { return false; // step 3.b } k += cp['[[CodeUnitCount]]']; // step 3.c } return true; // step 4 };