@thi.ng/equiv
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/equiv@1.0.2...@thi.ng/equiv@1.0.3) (2019-03-01) | ||
**Note:** Version bump only for package @thi.ng/equiv | ||
## [1.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/equiv@1.0.1...@thi.ng/equiv@1.0.2) (2019-02-05) | ||
@@ -8,0 +16,0 @@ |
18
index.js
@@ -28,8 +28,10 @@ const OBJP = Object.getPrototypeOf({}); | ||
} | ||
if ((proto = Object.getPrototypeOf(a), proto == null || proto === OBJP) && | ||
(proto = Object.getPrototypeOf(b), proto == null || proto === OBJP)) { | ||
if (((proto = Object.getPrototypeOf(a)), proto == null || proto === OBJP) && | ||
((proto = Object.getPrototypeOf(b)), proto == null || proto === OBJP)) { | ||
return equivObject(a, b); | ||
} | ||
if (typeof a !== FN && a.length !== undefined && | ||
typeof b !== FN && b.length !== undefined) { | ||
if (typeof a !== FN && | ||
a.length !== undefined && | ||
typeof b !== FN && | ||
b.length !== undefined) { | ||
return equivArrayLike(a, b); | ||
@@ -50,3 +52,3 @@ } | ||
// NaN | ||
return (a !== a && b !== b); | ||
return a !== a && b !== b; | ||
}; | ||
@@ -61,6 +63,4 @@ export const equivArrayLike = (a, b, _equiv = equiv) => { | ||
}; | ||
export const equivSet = (a, b, _equiv = equiv) => (a.size === b.size) && | ||
_equiv([...a.keys()].sort(), [...b.keys()].sort()); | ||
export const equivMap = (a, b, _equiv = equiv) => (a.size === b.size) && | ||
_equiv([...a].sort(), [...b].sort()); | ||
export const equivSet = (a, b, _equiv = equiv) => a.size === b.size && _equiv([...a.keys()].sort(), [...b.keys()].sort()); | ||
export const equivMap = (a, b, _equiv = equiv) => a.size === b.size && _equiv([...a].sort(), [...b].sort()); | ||
export const equivObject = (a, b, _equiv = equiv) => { | ||
@@ -67,0 +67,0 @@ if (Object.keys(a).length !== Object.keys(b).length) { |
@@ -32,8 +32,10 @@ 'use strict'; | ||
} | ||
if ((proto = Object.getPrototypeOf(a), proto == null || proto === OBJP) && | ||
(proto = Object.getPrototypeOf(b), proto == null || proto === OBJP)) { | ||
if (((proto = Object.getPrototypeOf(a)), proto == null || proto === OBJP) && | ||
((proto = Object.getPrototypeOf(b)), proto == null || proto === OBJP)) { | ||
return equivObject(a, b); | ||
} | ||
if (typeof a !== FN && a.length !== undefined && | ||
typeof b !== FN && b.length !== undefined) { | ||
if (typeof a !== FN && | ||
a.length !== undefined && | ||
typeof b !== FN && | ||
b.length !== undefined) { | ||
return equivArrayLike(a, b); | ||
@@ -53,3 +55,3 @@ } | ||
} | ||
return (a !== a && b !== b); | ||
return a !== a && b !== b; | ||
}; | ||
@@ -64,6 +66,4 @@ const equivArrayLike = (a, b, _equiv = equiv) => { | ||
}; | ||
const equivSet = (a, b, _equiv = equiv) => (a.size === b.size) && | ||
_equiv([...a.keys()].sort(), [...b.keys()].sort()); | ||
const equivMap = (a, b, _equiv = equiv) => (a.size === b.size) && | ||
_equiv([...a].sort(), [...b].sort()); | ||
const equivSet = (a, b, _equiv = equiv) => a.size === b.size && _equiv([...a.keys()].sort(), [...b.keys()].sort()); | ||
const equivMap = (a, b, _equiv = equiv) => a.size === b.size && _equiv([...a].sort(), [...b].sort()); | ||
const equivObject = (a, b, _equiv = equiv) => { | ||
@@ -70,0 +70,0 @@ if (Object.keys(a).length !== Object.keys(b).length) { |
@@ -34,8 +34,10 @@ (function (global, factory) { | ||
} | ||
if ((proto = Object.getPrototypeOf(a), proto == null || proto === OBJP) && | ||
(proto = Object.getPrototypeOf(b), proto == null || proto === OBJP)) { | ||
if (((proto = Object.getPrototypeOf(a)), proto == null || proto === OBJP) && | ||
((proto = Object.getPrototypeOf(b)), proto == null || proto === OBJP)) { | ||
return equivObject(a, b); | ||
} | ||
if (typeof a !== FN && a.length !== undefined && | ||
typeof b !== FN && b.length !== undefined) { | ||
if (typeof a !== FN && | ||
a.length !== undefined && | ||
typeof b !== FN && | ||
b.length !== undefined) { | ||
return equivArrayLike(a, b); | ||
@@ -55,3 +57,3 @@ } | ||
} | ||
return (a !== a && b !== b); | ||
return a !== a && b !== b; | ||
}; | ||
@@ -66,6 +68,4 @@ const equivArrayLike = (a, b, _equiv = equiv) => { | ||
}; | ||
const equivSet = (a, b, _equiv = equiv) => (a.size === b.size) && | ||
_equiv([...a.keys()].sort(), [...b.keys()].sort()); | ||
const equivMap = (a, b, _equiv = equiv) => (a.size === b.size) && | ||
_equiv([...a].sort(), [...b].sort()); | ||
const equivSet = (a, b, _equiv = equiv) => a.size === b.size && _equiv([...a.keys()].sort(), [...b.keys()].sort()); | ||
const equivMap = (a, b, _equiv = equiv) => a.size === b.size && _equiv([...a].sort(), [...b].sort()); | ||
const equivObject = (a, b, _equiv = equiv) => { | ||
@@ -72,0 +72,0 @@ if (Object.keys(a).length !== Object.keys(b).length) { |
{ | ||
"name": "@thi.ng/equiv", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Extensible deep equivalence checking for any data types", | ||
@@ -56,3 +56,3 @@ "module": "./index.js", | ||
"sideEffects": false, | ||
"gitHead": "74fb4d83013785ce7a95357c565426a046657e74" | ||
"gitHead": "e43f57c7554fd78380bba58d37ae62ca01221eeb" | ||
} |
Sorry, the diff of this file is not supported yet
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
33510