flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
26
VISUALIZACION/node_modules/es-abstract/2022/IsStringWellFormedUnicode.js
generated
vendored
Executable file
26
VISUALIZACION/node_modules/es-abstract/2022/IsStringWellFormedUnicode.js
generated
vendored
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var CodePointAt = require('./CodePointAt');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/13.0/#sec-isstringwellformedunicode
|
||||
|
||||
module.exports = function IsStringWellFormedUnicode(string) {
|
||||
if (Type(string) !== 'String') {
|
||||
throw new $TypeError('Assertion failed: `string` must be a String');
|
||||
}
|
||||
var strLen = string.length; // step 1
|
||||
var k = 0; // step 2
|
||||
while (k !== strLen) { // 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
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue