yeet
This commit is contained in:
44
node_modules/es-abstract/2020/Number/add.js
generated
vendored
Normal file
44
node_modules/es-abstract/2020/Number/add.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-add
|
||||
|
||||
module.exports = function NumberAdd(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
if (isNaN(x) || isNaN(y) || (x === Infinity && y === -Infinity) || (x === -Infinity && y === Infinity)) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
if ((x === Infinity && y === Infinity) || (x === -Infinity && y === -Infinity)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
if (x === Infinity) {
|
||||
return x;
|
||||
}
|
||||
|
||||
if (y === Infinity) {
|
||||
return y;
|
||||
}
|
||||
|
||||
if (x === y && x === 0) {
|
||||
return Infinity / x === -Infinity && Infinity / y === -Infinity ? -0 : +0;
|
||||
}
|
||||
|
||||
if (x === -y || -x === y) {
|
||||
return +0;
|
||||
}
|
||||
|
||||
// shortcut for the actual spec mechanics
|
||||
return x + y;
|
||||
};
|
17
node_modules/es-abstract/2020/Number/bitwiseAND.js
generated
vendored
Normal file
17
node_modules/es-abstract/2020/Number/bitwiseAND.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var NumberBitwiseOp = require('../NumberBitwiseOp');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND
|
||||
|
||||
module.exports = function NumberBitwiseAND(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
return NumberBitwiseOp('&', x, y);
|
||||
};
|
19
node_modules/es-abstract/2020/Number/bitwiseNOT.js
generated
vendored
Normal file
19
node_modules/es-abstract/2020/Number/bitwiseNOT.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var ToInt32 = require('../ToInt32');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT
|
||||
|
||||
module.exports = function NumberBitwiseNOT(x) {
|
||||
if (Type(x) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` argument must be a Number');
|
||||
}
|
||||
var oldValue = ToInt32(x);
|
||||
// Return the result of applying the bitwise operator op to lnum and rnum. The result is a signed 32-bit integer.
|
||||
return ~oldValue;
|
||||
};
|
17
node_modules/es-abstract/2020/Number/bitwiseOR.js
generated
vendored
Normal file
17
node_modules/es-abstract/2020/Number/bitwiseOR.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var NumberBitwiseOp = require('../NumberBitwiseOp');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR
|
||||
|
||||
module.exports = function NumberBitwiseOR(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
return NumberBitwiseOp('|', x, y);
|
||||
};
|
17
node_modules/es-abstract/2020/Number/bitwiseXOR.js
generated
vendored
Normal file
17
node_modules/es-abstract/2020/Number/bitwiseXOR.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var NumberBitwiseOp = require('../NumberBitwiseOp');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR
|
||||
|
||||
module.exports = function NumberBitwiseXOR(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
return NumberBitwiseOp('^', x, y);
|
||||
};
|
22
node_modules/es-abstract/2020/Number/divide.js
generated
vendored
Normal file
22
node_modules/es-abstract/2020/Number/divide.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isFinite = require('../../helpers/isFinite');
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide
|
||||
|
||||
module.exports = function NumberDivide(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) {
|
||||
return NaN;
|
||||
}
|
||||
// shortcut for the actual spec mechanics
|
||||
return x / y;
|
||||
};
|
21
node_modules/es-abstract/2020/Number/equal.js
generated
vendored
Normal file
21
node_modules/es-abstract/2020/Number/equal.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal
|
||||
|
||||
module.exports = function NumberEqual(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
return false;
|
||||
}
|
||||
// shortcut for the actual spec mechanics
|
||||
return x === y;
|
||||
};
|
77
node_modules/es-abstract/2020/Number/exponentiate.js
generated
vendored
Normal file
77
node_modules/es-abstract/2020/Number/exponentiate.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
// var isNegativeZero = require('is-negative-zero');
|
||||
|
||||
var $pow = GetIntrinsic('%Math.pow%');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
/*
|
||||
var abs = require('../../helpers/abs');
|
||||
var isFinite = require('../../helpers/isFinite');
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var IsInteger = require('../IsInteger');
|
||||
*/
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate
|
||||
|
||||
/* eslint max-lines-per-function: 0, max-statements: 0 */
|
||||
|
||||
module.exports = function NumberExponentiate(base, exponent) {
|
||||
if (Type(base) !== 'Number' || Type(exponent) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be Numbers');
|
||||
}
|
||||
return $pow(base, exponent);
|
||||
/*
|
||||
if (isNaN(exponent)) {
|
||||
return NaN;
|
||||
}
|
||||
if (exponent === 0) {
|
||||
return 1;
|
||||
}
|
||||
if (isNaN(base)) {
|
||||
return NaN;
|
||||
}
|
||||
var aB = abs(base);
|
||||
if (aB > 1 && exponent === Infinity) {
|
||||
return Infinity;
|
||||
}
|
||||
if (aB > 1 && exponent === -Infinity) {
|
||||
return 0;
|
||||
}
|
||||
if (aB === 1 && (exponent === Infinity || exponent === -Infinity)) {
|
||||
return NaN;
|
||||
}
|
||||
if (aB < 1 && exponent === Infinity) {
|
||||
return +0;
|
||||
}
|
||||
if (aB < 1 && exponent === -Infinity) {
|
||||
return Infinity;
|
||||
}
|
||||
if (base === Infinity) {
|
||||
return exponent > 0 ? Infinity : 0;
|
||||
}
|
||||
if (base === -Infinity) {
|
||||
var isOdd = true;
|
||||
if (exponent > 0) {
|
||||
return isOdd ? -Infinity : Infinity;
|
||||
}
|
||||
return isOdd ? -0 : 0;
|
||||
}
|
||||
if (exponent > 0) {
|
||||
return isNegativeZero(base) ? Infinity : 0;
|
||||
}
|
||||
if (isNegativeZero(base)) {
|
||||
if (exponent > 0) {
|
||||
return isOdd ? -0 : 0;
|
||||
}
|
||||
return isOdd ? -Infinity : Infinity;
|
||||
}
|
||||
if (base < 0 && isFinite(base) && isFinite(exponent) && !IsInteger(exponent)) {
|
||||
return NaN;
|
||||
}
|
||||
*/
|
||||
};
|
43
node_modules/es-abstract/2020/Number/index.js
generated
vendored
Normal file
43
node_modules/es-abstract/2020/Number/index.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
var add = require('./add');
|
||||
var bitwiseAND = require('./bitwiseAND');
|
||||
var bitwiseNOT = require('./bitwiseNOT');
|
||||
var bitwiseOR = require('./bitwiseOR');
|
||||
var bitwiseXOR = require('./bitwiseXOR');
|
||||
var divide = require('./divide');
|
||||
var equal = require('./equal');
|
||||
var exponentiate = require('./exponentiate');
|
||||
var leftShift = require('./leftShift');
|
||||
var lessThan = require('./lessThan');
|
||||
var multiply = require('./multiply');
|
||||
var remainder = require('./remainder');
|
||||
var sameValue = require('./sameValue');
|
||||
var sameValueZero = require('./sameValueZero');
|
||||
var signedRightShift = require('./signedRightShift');
|
||||
var subtract = require('./subtract');
|
||||
var toString = require('./toString');
|
||||
var unaryMinus = require('./unaryMinus');
|
||||
var unsignedRightShift = require('./unsignedRightShift');
|
||||
|
||||
module.exports = {
|
||||
add: add,
|
||||
bitwiseAND: bitwiseAND,
|
||||
bitwiseNOT: bitwiseNOT,
|
||||
bitwiseOR: bitwiseOR,
|
||||
bitwiseXOR: bitwiseXOR,
|
||||
divide: divide,
|
||||
equal: equal,
|
||||
exponentiate: exponentiate,
|
||||
leftShift: leftShift,
|
||||
lessThan: lessThan,
|
||||
multiply: multiply,
|
||||
remainder: remainder,
|
||||
sameValue: sameValue,
|
||||
sameValueZero: sameValueZero,
|
||||
signedRightShift: signedRightShift,
|
||||
subtract: subtract,
|
||||
toString: toString,
|
||||
unaryMinus: unaryMinus,
|
||||
unsignedRightShift: unsignedRightShift
|
||||
};
|
24
node_modules/es-abstract/2020/Number/leftShift.js
generated
vendored
Normal file
24
node_modules/es-abstract/2020/Number/leftShift.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var ToInt32 = require('../ToInt32');
|
||||
var ToUint32 = require('../ToUint32');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-leftShift
|
||||
|
||||
module.exports = function NumberLeftShift(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
var lnum = ToInt32(x);
|
||||
var rnum = ToUint32(y);
|
||||
|
||||
var shiftCount = rnum & 0x1F;
|
||||
|
||||
return lnum << shiftCount;
|
||||
};
|
26
node_modules/es-abstract/2020/Number/lessThan.js
generated
vendored
Normal file
26
node_modules/es-abstract/2020/Number/lessThan.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan
|
||||
|
||||
module.exports = function NumberLessThan(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
// If x is NaN, return undefined.
|
||||
// If y is NaN, return undefined.
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
return void undefined;
|
||||
}
|
||||
|
||||
// shortcut for the actual spec mechanics
|
||||
return x < y;
|
||||
};
|
33
node_modules/es-abstract/2020/Number/multiply.js
generated
vendored
Normal file
33
node_modules/es-abstract/2020/Number/multiply.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply
|
||||
|
||||
module.exports = function NumberMultiply(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
if (isNaN(x) || isNaN(y) || (x === 0 && !isFinite(y)) || (!isFinite(x) && y === 0)) {
|
||||
return NaN;
|
||||
}
|
||||
if (!isFinite(x) && !isFinite(y)) {
|
||||
return x === y ? Infinity : -Infinity;
|
||||
}
|
||||
if (!isFinite(x) && y !== 0) {
|
||||
return x > 0 ? Infinity : -Infinity;
|
||||
}
|
||||
if (!isFinite(y) && x !== 0) {
|
||||
return y > 0 ? Infinity : -Infinity;
|
||||
}
|
||||
|
||||
// shortcut for the actual spec mechanics
|
||||
return x * y;
|
||||
};
|
32
node_modules/es-abstract/2020/Number/remainder.js
generated
vendored
Normal file
32
node_modules/es-abstract/2020/Number/remainder.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-remainder
|
||||
|
||||
module.exports = function NumberRemainder(n, d) {
|
||||
if (Type(n) !== 'Number' || Type(d) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers');
|
||||
}
|
||||
|
||||
// If either operand is NaN, the result is NaN.
|
||||
// If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
|
||||
if (isNaN(n) || isNaN(d) || !isFinite(n) || d === 0) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
// If the dividend is finite and the divisor is an infinity, the result equals the dividend.
|
||||
// If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend.
|
||||
if (!isFinite(d) || (n === 0 && d !== 0)) {
|
||||
return n;
|
||||
}
|
||||
|
||||
// In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved…
|
||||
return n % d;
|
||||
};
|
21
node_modules/es-abstract/2020/Number/sameValue.js
generated
vendored
Normal file
21
node_modules/es-abstract/2020/Number/sameValue.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var isNegativeZero = require('is-negative-zero');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Type = require('../Type');
|
||||
var NumberSameValueZero = require('./sameValueZero');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue
|
||||
|
||||
module.exports = function NumberSameValue(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
if (x === 0 && y === 0) {
|
||||
return !(isNegativeZero(x) ^ isNegativeZero(y));
|
||||
}
|
||||
return NumberSameValueZero(x, y);
|
||||
};
|
24
node_modules/es-abstract/2020/Number/sameValueZero.js
generated
vendored
Normal file
24
node_modules/es-abstract/2020/Number/sameValueZero.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero
|
||||
|
||||
module.exports = function NumberSameValueZero(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
var xNaN = isNaN(x);
|
||||
var yNaN = isNaN(y);
|
||||
if (xNaN || yNaN) {
|
||||
return xNaN === yNaN;
|
||||
}
|
||||
return x === y;
|
||||
};
|
24
node_modules/es-abstract/2020/Number/signedRightShift.js
generated
vendored
Normal file
24
node_modules/es-abstract/2020/Number/signedRightShift.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var ToInt32 = require('../ToInt32');
|
||||
var ToUint32 = require('../ToUint32');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-signedRightShift
|
||||
|
||||
module.exports = function NumberSignedRightShift(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
var lnum = ToInt32(x);
|
||||
var rnum = ToUint32(y);
|
||||
|
||||
var shiftCount = rnum & 0x1F;
|
||||
|
||||
return lnum >> shiftCount;
|
||||
};
|
16
node_modules/es-abstract/2020/Number/subtract.js
generated
vendored
Normal file
16
node_modules/es-abstract/2020/Number/subtract.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-subtract
|
||||
|
||||
module.exports = function NumberSubtract(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
return x - y;
|
||||
};
|
18
node_modules/es-abstract/2020/Number/toString.js
generated
vendored
Normal file
18
node_modules/es-abstract/2020/Number/toString.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $String = GetIntrinsic('%String%');
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-tostring
|
||||
|
||||
module.exports = function NumberToString(x) {
|
||||
if (Type(x) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` must be a Number');
|
||||
}
|
||||
|
||||
return $String(x);
|
||||
};
|
21
node_modules/es-abstract/2020/Number/unaryMinus.js
generated
vendored
Normal file
21
node_modules/es-abstract/2020/Number/unaryMinus.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-unaryMinus
|
||||
|
||||
module.exports = function NumberUnaryMinus(x) {
|
||||
if (Type(x) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` argument must be a Number');
|
||||
}
|
||||
if (isNaN(x)) {
|
||||
return NaN;
|
||||
}
|
||||
return -x;
|
||||
};
|
24
node_modules/es-abstract/2020/Number/unsignedRightShift.js
generated
vendored
Normal file
24
node_modules/es-abstract/2020/Number/unsignedRightShift.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var ToInt32 = require('../ToInt32');
|
||||
var ToUint32 = require('../ToUint32');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-unsignedRightShift
|
||||
|
||||
module.exports = function NumberUnsignedRightShift(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
var lnum = ToInt32(x);
|
||||
var rnum = ToUint32(y);
|
||||
|
||||
var shiftCount = rnum & 0x1F;
|
||||
|
||||
return lnum >>> shiftCount;
|
||||
};
|
Reference in New Issue
Block a user