@longlast/equals 0.5.9 → 0.5.10
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 -9
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* @module equals
|
|
3
3
|
*/
|
|
4
4
|
import { curry } from "@longlast/curry";
|
|
5
|
-
import {
|
|
5
|
+
import { getBoundArguments, getUnapplied } from "@longlast/function-provenance";
|
|
6
|
+
import { $equals } from "@longlast/symbols";
|
|
6
7
|
/**
|
|
7
8
|
* @function
|
|
8
9
|
* A version of {@link equals} that allows callers to override the default
|
|
@@ -47,10 +48,9 @@ function _equalsWith(options, a, b) {
|
|
|
47
48
|
return true;
|
|
48
49
|
}
|
|
49
50
|
if (typeof a === "function" && typeof b === "function") {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
aUnapplied === bUnapplied &&
|
|
51
|
+
unsafeNarrow(a);
|
|
52
|
+
unsafeNarrow(b);
|
|
53
|
+
return (getUnapplied(a) === getUnapplied(b) &&
|
|
54
54
|
_equalsWith(options, getBoundArguments(a), getBoundArguments(b)));
|
|
55
55
|
}
|
|
56
56
|
// If `a` is a primitive at this point, return false, since we already know
|
|
@@ -186,10 +186,6 @@ function _equalsWith(options, a, b) {
|
|
|
186
186
|
*/
|
|
187
187
|
// TODO: clear function provenance on `equals`.
|
|
188
188
|
export const equals = equalsWith({});
|
|
189
|
-
function getBoundArguments(f) {
|
|
190
|
-
// TODO: (pre-1.0.0) remove `f[$boundArguments]` fallback.
|
|
191
|
-
return f[$getBoundArguments]?.() ?? f[$boundArguments];
|
|
192
|
-
}
|
|
193
189
|
function functionString(f) {
|
|
194
190
|
if (typeof f !== "function") {
|
|
195
191
|
return "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longlast/equals",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "Deeply compares objects",
|
|
5
5
|
"homepage": "https://longlast.js.org/",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
"#@longlast/equals": "./src/index.ts"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@longlast/any-function": "^0.0.1",
|
|
20
21
|
"@longlast/curry": "^0.5.0",
|
|
21
|
-
"@longlast/
|
|
22
|
+
"@longlast/function-provenance": "^0.0.3",
|
|
23
|
+
"@longlast/symbols": "^1.1.0"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
26
|
"fast-deep-equal": "3.1.3"
|