@longlast/equals 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module equals
|
|
3
3
|
*/
|
|
4
4
|
import { curry } from "@longlast/curry";
|
|
5
|
-
import { $boundArguments, $equals, $unapplied } from "@longlast/symbols";
|
|
5
|
+
import { $boundArguments, $equals, $getBoundArguments, $unapplied, } from "@longlast/symbols";
|
|
6
6
|
/**
|
|
7
7
|
* @function
|
|
8
8
|
* Deeply compares two values, returning true if they're equal and false
|
|
@@ -88,13 +88,11 @@ function _equals(a, b) {
|
|
|
88
88
|
return a.size === b.size && [...a].every((v) => b.has(v));
|
|
89
89
|
}
|
|
90
90
|
if (typeof a === "function" && typeof b === "function") {
|
|
91
|
-
const aArgs = a[$boundArguments];
|
|
92
|
-
const bArgs = b[$boundArguments];
|
|
93
91
|
const aUnapplied = a[$unapplied];
|
|
94
92
|
const bUnapplied = b[$unapplied];
|
|
95
93
|
return (aUnapplied != null &&
|
|
96
94
|
aUnapplied === bUnapplied &&
|
|
97
|
-
_equals(
|
|
95
|
+
_equals(getBoundArguments(a), getBoundArguments(b)));
|
|
98
96
|
}
|
|
99
97
|
if (a && b && typeof a === "object" && protoOf(a) === protoOf(b)) {
|
|
100
98
|
const bKeys = new Set(Object.keys(b));
|
|
@@ -110,4 +108,7 @@ function _equals(a, b) {
|
|
|
110
108
|
}
|
|
111
109
|
return false;
|
|
112
110
|
}
|
|
111
|
+
function getBoundArguments(f) {
|
|
112
|
+
return f[$getBoundArguments]?.() ?? f[$boundArguments];
|
|
113
|
+
}
|
|
113
114
|
const protoOf = Object.getPrototypeOf;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longlast/equals",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Deeply compares objects",
|
|
5
5
|
"homepage": "https://longlast.js.org/",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"#@longlast/equals": "./src/index.ts"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@longlast/curry": "^0.
|
|
20
|
+
"@longlast/curry": "^0.5.0",
|
|
21
21
|
"@longlast/symbols": "^1.0.0"
|
|
22
22
|
}
|
|
23
23
|
}
|