refactor start
This commit is contained in:
parent
bd49791e06
commit
e46d25f0b7
16699 changed files with 2 additions and 1484887 deletions
25
home/ags/node_modules/es-abstract/2022/UnicodeEscape.js
generated
vendored
25
home/ags/node_modules/es-abstract/2022/UnicodeEscape.js
generated
vendored
|
|
@ -1,25 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $charCodeAt = callBound('String.prototype.charCodeAt');
|
||||
var $numberToString = callBound('Number.prototype.toString');
|
||||
var $toLowerCase = callBound('String.prototype.toLowerCase');
|
||||
|
||||
var StringPad = require('./StringPad');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-unicodeescape
|
||||
|
||||
module.exports = function UnicodeEscape(C) {
|
||||
if (typeof C !== 'string' || C.length !== 1) {
|
||||
throw new $TypeError('Assertion failed: `C` must be a single code unit');
|
||||
}
|
||||
var n = $charCodeAt(C, 0);
|
||||
if (n > 0xFFFF) {
|
||||
throw new $TypeError('`Assertion failed: numeric value of `C` must be <= 0xFFFF');
|
||||
}
|
||||
|
||||
return '\\u' + StringPad($toLowerCase($numberToString(n, 16)), 4, '0', 'start');
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue