es-abstract
Advanced tools
Comparing version 1.18.7 to 1.19.0
'use strict'; | ||
var StrictEqualityComparison = require('./StrictEqualityComparison'); | ||
var StringToBigInt = require('./StringToBigInt'); | ||
var ToNumber = require('./ToNumber'); | ||
@@ -7,4 +9,6 @@ var ToPrimitive = require('./ToPrimitive'); | ||
// https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison | ||
var isNaN = require('../helpers/isNaN'); | ||
// https://ecma-international.org/ecma-262/11.0/#sec-abstract-equality-comparison | ||
module.exports = function AbstractEqualityComparison(x, y) { | ||
@@ -14,3 +18,3 @@ var xType = Type(x); | ||
if (xType === yType) { | ||
return x === y; // ES6+ specified this shortcut anyways. | ||
return StrictEqualityComparison(x, y); | ||
} | ||
@@ -26,2 +30,12 @@ if (x == null && y == null) { | ||
} | ||
if (xType === 'BigInt' && yType === 'String') { | ||
var n = StringToBigInt(y); | ||
if (isNaN(n)) { | ||
return false; | ||
} | ||
return AbstractEqualityComparison(x, n); | ||
} | ||
if (xType === 'String' && yType === 'BigInt') { | ||
return AbstractEqualityComparison(y, x); | ||
} | ||
if (xType === 'Boolean') { | ||
@@ -33,9 +47,15 @@ return AbstractEqualityComparison(ToNumber(x), y); | ||
} | ||
if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') { | ||
if ((xType === 'String' || xType === 'Number' || xType === 'BigInt' || xType === 'Symbol') && yType === 'Object') { | ||
return AbstractEqualityComparison(x, ToPrimitive(y)); | ||
} | ||
if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) { | ||
if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'BigInt' || yType === 'Symbol')) { | ||
return AbstractEqualityComparison(ToPrimitive(x), y); | ||
} | ||
if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) { | ||
if (isNaN(x) || isNaN(y) || x === Infinity || y === Infinity || x === -Infinity || y === -Infinity) { | ||
return false; | ||
} | ||
return x == y; // eslint-disable-line eqeqeq | ||
} | ||
return false; | ||
}; |
@@ -9,11 +9,15 @@ 'use strict'; | ||
var $isNaN = require('../helpers/isNaN'); | ||
var $isFinite = require('../helpers/isFinite'); | ||
var IsStringPrefix = require('./IsStringPrefix'); | ||
var ToNumber = require('./ToNumber'); | ||
var StringToBigInt = require('./StringToBigInt'); | ||
var ToNumeric = require('./ToNumeric'); | ||
var ToPrimitive = require('./ToPrimitive'); | ||
var Type = require('./Type'); | ||
var BigIntLessThan = require('./BigInt/lessThan'); | ||
var NumberLessThan = require('./Number/lessThan'); | ||
// https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison | ||
// eslint-disable-next-line max-statements, max-lines-per-function | ||
module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { | ||
@@ -41,23 +45,40 @@ if (Type(LeftFirst) !== 'Boolean') { | ||
} | ||
var nx = ToNumber(px); | ||
var ny = ToNumber(py); | ||
if ($isNaN(nx) || $isNaN(ny)) { | ||
return undefined; | ||
var pxType = Type(px); | ||
var pyType = Type(py); | ||
var nx; | ||
var ny; | ||
if (pxType === 'BigInt' && pyType === 'String') { | ||
ny = StringToBigInt(py); | ||
if ($isNaN(ny)) { | ||
return void undefined; | ||
} | ||
return BigIntLessThan(px, ny); | ||
} | ||
if ($isFinite(nx) && $isFinite(ny) && nx === ny) { | ||
return false; | ||
if (pxType === 'String' && pyType === 'BigInt') { | ||
nx = StringToBigInt(px); | ||
if ($isNaN(nx)) { | ||
return void undefined; | ||
} | ||
return BigIntLessThan(px, ny); | ||
} | ||
if (nx === Infinity) { | ||
return false; | ||
nx = ToNumeric(px); | ||
ny = ToNumeric(py); | ||
var nxType = Type(nx); | ||
if (nxType === Type(ny)) { | ||
return nxType === 'Number' ? NumberLessThan(nx, ny) : BigIntLessThan(nx, ny); | ||
} | ||
if (ny === Infinity) { | ||
if ($isNaN(nx) || $isNaN(ny)) { | ||
return void undefined; | ||
} | ||
if (nx === -Infinity || ny === Infinity) { | ||
return true; | ||
} | ||
if (ny === -Infinity) { | ||
if (nx === Infinity || ny === -Infinity) { | ||
return false; | ||
} | ||
if (nx === -Infinity) { | ||
return true; | ||
} | ||
return nx < ny; // by now, these are both nonzero, finite, and not equal | ||
}; |
@@ -0,1 +1,16 @@ | ||
1.19.0 / 2021-09-30 | ||
================= | ||
* [New] `ES2021+`: `IterableToList`: make `method` parameter optional (#61) | ||
* [New] add ES2021 | ||
* [New] `ES2020+`: add `StringToBigInt`, `ToBigInt`, `ToBigInt64`, `ToBigUint64` | ||
* [New] `ES2017`+: add `IsSharedArrayBuffer`, `OrdinaryToPrimitive` | ||
* [New] `ES2015+`: add `CharacterRange`, `IsCompatiblePropertyDescriptor` | ||
* [New] `ES2020+`: add `CreateRegExpStringIterator` | ||
* [Fix] `ES2020+`: `ToBigInt64`/`ToBigUint64`: avoid node v10.4-v10.8 bug with limited BigInt range | ||
* [Fix] `ES2020+`: `AbstractRelationalComparison`, `AbstractEqualityComparison`: support BigInt | ||
* [Fix] `ES2020+`: `ToBigInt64`/`ToBigUint64`: Improve the definitions of twoSixtyThree and twoSixtyFour (#140) | ||
* [meta] do not publish .gitattributes | ||
* [Tests] Correct the behavior of `safeBigInt` | ||
* [Tests] Exclude dotfiles from the testing sweep (#141) | ||
1.18.7 / 2021-09-28 | ||
@@ -2,0 +17,0 @@ ================= |
@@ -16,2 +16,3 @@ 'use strict'; | ||
CanonicalNumericIndexString: require('./2015/CanonicalNumericIndexString'), | ||
CharacterRange: require('./2015/CharacterRange'), | ||
CompletePropertyDescriptor: require('./2015/CompletePropertyDescriptor'), | ||
@@ -50,2 +51,3 @@ CreateDataProperty: require('./2015/CreateDataProperty'), | ||
IsCallable: require('./2015/IsCallable'), | ||
IsCompatiblePropertyDescriptor: require('./2015/IsCompatiblePropertyDescriptor'), | ||
IsConcatSpreadable: require('./2015/IsConcatSpreadable'), | ||
@@ -52,0 +54,0 @@ IsConstructor: require('./2015/IsConstructor'), |
@@ -16,2 +16,3 @@ 'use strict'; | ||
CanonicalNumericIndexString: require('./2016/CanonicalNumericIndexString'), | ||
CharacterRange: require('./2016/CharacterRange'), | ||
CompletePropertyDescriptor: require('./2016/CompletePropertyDescriptor'), | ||
@@ -50,2 +51,3 @@ CreateDataProperty: require('./2016/CreateDataProperty'), | ||
IsCallable: require('./2016/IsCallable'), | ||
IsCompatiblePropertyDescriptor: require('./2016/IsCompatiblePropertyDescriptor'), | ||
IsConcatSpreadable: require('./2016/IsConcatSpreadable'), | ||
@@ -52,0 +54,0 @@ IsConstructor: require('./2016/IsConstructor'), |
@@ -16,2 +16,3 @@ 'use strict'; | ||
CanonicalNumericIndexString: require('./2017/CanonicalNumericIndexString'), | ||
CharacterRange: require('./2017/CharacterRange'), | ||
CompletePropertyDescriptor: require('./2017/CompletePropertyDescriptor'), | ||
@@ -50,2 +51,3 @@ CreateDataProperty: require('./2017/CreateDataProperty'), | ||
IsCallable: require('./2017/IsCallable'), | ||
IsCompatiblePropertyDescriptor: require('./2017/IsCompatiblePropertyDescriptor'), | ||
IsConcatSpreadable: require('./2017/IsConcatSpreadable'), | ||
@@ -61,2 +63,3 @@ IsConstructor: require('./2017/IsConstructor'), | ||
IsRegExp: require('./2017/IsRegExp'), | ||
IsSharedArrayBuffer: require('./2017/IsSharedArrayBuffer'), | ||
IterableToList: require('./2017/IterableToList'), | ||
@@ -83,2 +86,3 @@ IteratorClose: require('./2017/IteratorClose'), | ||
OrdinarySetPrototypeOf: require('./2017/OrdinarySetPrototypeOf'), | ||
OrdinaryToPrimitive: require('./2017/OrdinaryToPrimitive'), | ||
QuoteJSONString: require('./2017/QuoteJSONString'), | ||
@@ -85,0 +89,0 @@ RegExpCreate: require('./2017/RegExpCreate'), |
@@ -16,2 +16,3 @@ 'use strict'; | ||
CanonicalNumericIndexString: require('./2018/CanonicalNumericIndexString'), | ||
CharacterRange: require('./2018/CharacterRange'), | ||
CompletePropertyDescriptor: require('./2018/CompletePropertyDescriptor'), | ||
@@ -52,2 +53,3 @@ CopyDataProperties: require('./2018/CopyDataProperties'), | ||
IsCallable: require('./2018/IsCallable'), | ||
IsCompatiblePropertyDescriptor: require('./2018/IsCompatiblePropertyDescriptor'), | ||
IsConcatSpreadable: require('./2018/IsConcatSpreadable'), | ||
@@ -62,2 +64,3 @@ IsConstructor: require('./2018/IsConstructor'), | ||
IsRegExp: require('./2018/IsRegExp'), | ||
IsSharedArrayBuffer: require('./2018/IsSharedArrayBuffer'), | ||
IsStringPrefix: require('./2018/IsStringPrefix'), | ||
@@ -86,2 +89,3 @@ IterableToList: require('./2018/IterableToList'), | ||
OrdinarySetPrototypeOf: require('./2018/OrdinarySetPrototypeOf'), | ||
OrdinaryToPrimitive: require('./2018/OrdinaryToPrimitive'), | ||
PromiseResolve: require('./2018/PromiseResolve'), | ||
@@ -88,0 +92,0 @@ QuoteJSONString: require('./2018/QuoteJSONString'), |
@@ -17,2 +17,3 @@ 'use strict'; | ||
CanonicalNumericIndexString: require('./2019/CanonicalNumericIndexString'), | ||
CharacterRange: require('./2019/CharacterRange'), | ||
CompletePropertyDescriptor: require('./2019/CompletePropertyDescriptor'), | ||
@@ -54,2 +55,3 @@ CopyDataProperties: require('./2019/CopyDataProperties'), | ||
IsCallable: require('./2019/IsCallable'), | ||
IsCompatiblePropertyDescriptor: require('./2019/IsCompatiblePropertyDescriptor'), | ||
IsConcatSpreadable: require('./2019/IsConcatSpreadable'), | ||
@@ -64,2 +66,3 @@ IsConstructor: require('./2019/IsConstructor'), | ||
IsRegExp: require('./2019/IsRegExp'), | ||
IsSharedArrayBuffer: require('./2019/IsSharedArrayBuffer'), | ||
IsStringPrefix: require('./2019/IsStringPrefix'), | ||
@@ -88,2 +91,3 @@ IterableToList: require('./2019/IterableToList'), | ||
OrdinarySetPrototypeOf: require('./2019/OrdinarySetPrototypeOf'), | ||
OrdinaryToPrimitive: require('./2019/OrdinaryToPrimitive'), | ||
PromiseResolve: require('./2019/PromiseResolve'), | ||
@@ -90,0 +94,0 @@ QuoteJSONString: require('./2019/QuoteJSONString'), |
@@ -22,2 +22,3 @@ 'use strict'; | ||
CanonicalNumericIndexString: require('./2020/CanonicalNumericIndexString'), | ||
CharacterRange: require('./2020/CharacterRange'), | ||
CodePointAt: require('./2020/CodePointAt'), | ||
@@ -32,2 +33,3 @@ CompletePropertyDescriptor: require('./2020/CompletePropertyDescriptor'), | ||
CreateMethodProperty: require('./2020/CreateMethodProperty'), | ||
CreateRegExpStringIterator: require('./2020/CreateRegExpStringIterator'), | ||
DateFromTime: require('./2020/DateFromTime'), | ||
@@ -62,2 +64,3 @@ DateString: require('./2020/DateString'), | ||
IsCallable: require('./2020/IsCallable'), | ||
IsCompatiblePropertyDescriptor: require('./2020/IsCompatiblePropertyDescriptor'), | ||
IsConcatSpreadable: require('./2020/IsConcatSpreadable'), | ||
@@ -74,2 +77,3 @@ IsConstructor: require('./2020/IsConstructor'), | ||
IsRegExp: require('./2020/IsRegExp'), | ||
IsSharedArrayBuffer: require('./2020/IsSharedArrayBuffer'), | ||
IsStringPrefix: require('./2020/IsStringPrefix'), | ||
@@ -103,2 +107,3 @@ IsUnclampedIntegerElementType: require('./2020/IsUnclampedIntegerElementType'), | ||
OrdinarySetPrototypeOf: require('./2020/OrdinarySetPrototypeOf'), | ||
OrdinaryToPrimitive: require('./2020/OrdinaryToPrimitive'), | ||
PromiseResolve: require('./2020/PromiseResolve'), | ||
@@ -122,2 +127,3 @@ QuoteJSONString: require('./2020/QuoteJSONString'), | ||
StringPad: require('./2020/StringPad'), | ||
StringToBigInt: require('./2020/StringToBigInt'), | ||
SymbolDescriptiveString: require('./2020/SymbolDescriptiveString'), | ||
@@ -135,2 +141,5 @@ TestIntegrityLevel: require('./2020/TestIntegrityLevel'), | ||
TimeWithinDay: require('./2020/TimeWithinDay'), | ||
ToBigInt: require('./2020/ToBigInt'), | ||
ToBigInt64: require('./2020/ToBigInt64'), | ||
ToBigUint64: require('./2020/ToBigUint64'), | ||
ToBoolean: require('./2020/ToBoolean'), | ||
@@ -137,0 +146,0 @@ ToDateString: require('./2020/ToDateString'), |
@@ -12,2 +12,3 @@ 'use strict'; | ||
var ES2020 = require('./es2020'); | ||
var ES2021 = require('./es2021'); | ||
@@ -23,3 +24,4 @@ var ES = { | ||
ES2019: ES2019, | ||
ES2020: ES2020 | ||
ES2020: ES2020, | ||
ES2021: ES2021 | ||
}; | ||
@@ -26,0 +28,0 @@ assign(ES, ES5); |
{ | ||
"name": "es-abstract", | ||
"version": "1.18.7", | ||
"version": "1.19.0", | ||
"author": { | ||
@@ -65,3 +65,5 @@ "name": "Jordan Harband", | ||
"is-regex": "^1.1.4", | ||
"is-shared-array-buffer": "^1.0.1", | ||
"is-string": "^1.0.7", | ||
"is-weakref": "^1.0.1", | ||
"object-inspect": "^1.11.0", | ||
@@ -77,2 +79,3 @@ "object-keys": "^1.1.1", | ||
"array.prototype.indexof": "^1.0.2", | ||
"array.prototype.filter": "^1.0.0", | ||
"aud": "^1.1.5", | ||
@@ -79,0 +82,0 @@ "cheerio": "=1.0.0-rc.3", |
@@ -14,3 +14,3 @@ # es-abstract <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
All abstract operations are also available under an `es5`/`es2015`/`es2016`/`es2017`/`es2018`/`es2019`/`es2020` entry point, and as a property on the `main` export, but using deep imports is highly encouraged for bundle size and performance reasons. Non-deep entry points will be removed in the next semver-major release. | ||
All abstract operations are also available under an `es5`/`es2015`/`es2016`/`es2017`/`es2018`/`es2019`/`es2020`/`es2021` entry point, and as a property on the `main` export, but using deep imports is highly encouraged for bundle size and performance reasons. Non-deep entry points will be removed in the next semver-major release. | ||
@@ -17,0 +17,0 @@ ## Example |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1135529
1146
27958
20
23
+ Addedis-weakref@^1.0.1
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-weakref@1.0.2(transitive)