@longlast/equals 0.5.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +5 -4
  2. package/package.json +3 -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(aArgs, bArgs));
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,7 +1,8 @@
1
1
  {
2
2
  "name": "@longlast/equals",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Deeply compares objects",
5
+ "homepage": "https://longlast.js.org/",
5
6
  "license": "MIT",
6
7
  "author": "Ben Christel (https://benchristel.com/)",
7
8
  "type": "module",
@@ -16,7 +17,7 @@
16
17
  "#@longlast/equals": "./src/index.ts"
17
18
  },
18
19
  "dependencies": {
19
- "@longlast/curry": "^0.4.0",
20
+ "@longlast/curry": "^0.5.0",
20
21
  "@longlast/symbols": "^1.0.0"
21
22
  }
22
23
  }