@tolki/utils 1.6.2 → 1.6.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/cast.js CHANGED
@@ -1,130 +1,99 @@
1
- import { isNull as s, isUndefined as a, isArray as b, isObject as c, isMap as d, isWeakMap as l, isWeakSet as A, isIterable as y, isBoolean as I, isFiniteNumber as m, isPhpAccessible as $, isFunction as f, isNumber as O, isPlainObject as w } from "./guards.js";
2
- import { keyedEntries as S, defineKey as T, hasOwnToString as j, isPhpArrayKey as B } from "./keys.js";
3
- import { phpDebugType as E } from "./reflect.js";
4
- const g = 14;
5
- function F(r) {
6
- return s(r) || a(r) || r === !1 ? "" : r === !0 ? "1" : O(r) || Number.isNaN(r) ? J(r) : String(r);
7
- }
8
- function J(r) {
9
- if (Number.isNaN(r))
10
- return "NAN";
11
- if (!Number.isFinite(r))
12
- return r > 0 ? "INF" : "-INF";
13
- if (B(r) && !Object.is(r, -0))
14
- return BigInt(r).toString();
15
- const [t, n] = P(Math.abs(r)), e = r < 0 || Object.is(r, -0) ? "-" : "";
16
- if (n < -3 || n > g) {
17
- const i = n - 1, p = `${t.charAt(0)}.${t.slice(1) || "0"}`;
18
- return `${e}${p}E${i < 0 ? "-" : "+"}${Math.abs(i)}`;
19
- }
20
- if (n <= 0)
21
- return `${e}0.${"0".repeat(-n)}${t}`;
22
- const o = t.slice(0, n).padEnd(n, "0"), u = t.slice(n);
23
- return u === "" ? `${e}${o}` : `${e}${o}.${u}`;
24
- }
25
- function P(r) {
26
- if (r === 0)
27
- return ["0", 1];
28
- let t = r, n = 0;
29
- for (; !Number.isInteger(t); )
30
- t *= 2, n++;
31
- const e = (BigInt(t) * 5n ** BigInt(n)).toString(), o = e.slice(g), u = "5".padEnd(o.length, "0");
32
- let i = e.slice(0, g), p = e.length - n;
33
- if (o > u || o === u && Number(i.at(-1)) % 2 === 1) {
34
- const N = String(BigInt(i) + 1n);
35
- p += N.length - i.length, i = N;
36
- }
37
- for (; i.endsWith("0"); )
38
- i = i.slice(0, -1);
39
- return [i, p];
40
- }
41
- function C(r) {
42
- return c(r) && !s(r) && f(r.toArray);
43
- }
44
- function K(r) {
45
- if (!c(r) || s(r))
46
- return !1;
47
- const t = f(r.toJson), n = f(r.toJSON);
48
- return t || n;
49
- }
50
- function W(r) {
51
- return c(r) && !s(r) && f(r.jsonSerialize);
52
- }
53
- function D(r) {
54
- return b(r) ? r : null;
55
- }
56
- function M(r) {
57
- return Array.isArray(r) ? r.slice() : null;
58
- }
59
- function L(r) {
60
- return M(r) || [];
61
- }
62
- function h(r) {
63
- if (w(r) || !c(r))
64
- return r;
65
- for (const t of ["all", "toArray", "toJSON"])
66
- if (f(r[t]))
67
- return h(r[t]());
68
- return r;
69
- }
70
- function V(r) {
71
- const t = h(r);
72
- return s(t) || a(t) ? [] : b(t) ? t.slice() : c(t) ? d(t) ? S(t).map(([, n]) => n) : y(t) ? [...t] : Object.values(t) : [t];
73
- }
74
- function _(r) {
75
- const t = h(r);
76
- if (s(t) || a(t))
77
- return {};
78
- if (b(t))
79
- return { ...t };
80
- if (c(t)) {
81
- if (d(t)) {
82
- const n = {};
83
- for (const [e, o] of S(t))
84
- T(n, e, o);
85
- return n;
86
- }
87
- return l(t) || A(t) ? {} : y(t) ? { ...[...t] } : t;
88
- }
89
- return { 0: t };
90
- }
91
- function H(r) {
92
- return s(r) || a(r) ? "" : I(r) ? r ? "1" : "" : String(r);
93
- }
94
- function R(r, t) {
95
- if (!m(r) || r < -9223372036854776e3 || r >= 2 ** 63)
96
- throw new TypeError(t);
97
- return Math.trunc(r);
98
- }
99
- function U(r) {
100
- if (!m(r))
101
- return 0;
102
- const t = Math.trunc(r);
103
- return t >= -9223372036854776e3 && t < 2 ** 63 ? t === 0 ? 0 : t : Number(BigInt.asIntN(64, BigInt(t)));
104
- }
105
- function q(r) {
106
- if ($(r))
107
- return "Array";
108
- if (j(r))
109
- return String(r.toString());
110
- if (c(r) || f(r))
111
- throw new Error(
112
- `Object of class ${E(r)} could not be converted to string`
113
- );
114
- return F(r);
115
- }
116
- export {
117
- _ as arrayableItems,
118
- V as arrayableValues,
119
- D as castableToArray,
120
- H as cssListItemToString,
121
- L as getAccessibleValues,
122
- M as normalizeToArray,
123
- R as phpIntArgument,
124
- U as phpIntCast,
125
- q as phpStringCast,
126
- C as toArrayable,
127
- W as toJsonSerializable,
128
- K as toJsonable,
129
- F as toPhpKeyString
130
- };
1
+ import { isArray as e, isBoolean as t, isFiniteNumber as n, isFunction as r, isIterable as i, isMap as a, isNull as o, isNumber as s, isObject as c, isPhpAccessible as l, isPlainObject as u, isUndefined as d, isWeakMap as f, isWeakSet as p } from "./guards.js";
2
+ import { phpDebugType as m } from "./reflect.js";
3
+ import { defineKey as h, hasOwnToString as g, isPhpArrayKey as _, keyedEntries as v } from "./keys.js";
4
+ // src/cast.ts
5
+ var y = 14;
6
+ function b(e) {
7
+ return o(e) || d(e) || e === !1 ? "" : e === !0 ? "1" : s(e) || Number.isNaN(e) ? x(e) : String(e);
8
+ }
9
+ function x(e) {
10
+ if (Number.isNaN(e)) return "NAN";
11
+ if (!Number.isFinite(e)) return e > 0 ? "INF" : "-INF";
12
+ if (_(e) && !Object.is(e, -0)) return BigInt(e).toString();
13
+ let [t, n] = S(Math.abs(e)), r = e < 0 || Object.is(e, -0) ? "-" : "";
14
+ if (n < -3 || n > y) {
15
+ let e = n - 1;
16
+ return `${r}${`${t.charAt(0)}.${t.slice(1) || "0"}`}E${e < 0 ? "-" : "+"}${Math.abs(e)}`;
17
+ }
18
+ if (n <= 0) return `${r}0.${"0".repeat(-n)}${t}`;
19
+ let i = t.slice(0, n).padEnd(n, "0"), a = t.slice(n);
20
+ return a === "" ? `${r}${i}` : `${r}${i}.${a}`;
21
+ }
22
+ function S(e) {
23
+ if (e === 0) return ["0", 1];
24
+ let t = e, n = 0;
25
+ for (; !Number.isInteger(t);) t *= 2, n++;
26
+ let r = (BigInt(t) * 5n ** BigInt(n)).toString(), i = r.slice(y), a = "5".padEnd(i.length, "0"), o = r.slice(0, y), s = r.length - n;
27
+ if (i > a || i === a && Number(o.at(-1)) % 2 == 1) {
28
+ let e = String(BigInt(o) + 1n);
29
+ s += e.length - o.length, o = e;
30
+ }
31
+ for (; o.endsWith("0");) o = o.slice(0, -1);
32
+ return [o, s];
33
+ }
34
+ function C(e) {
35
+ return c(e) && !o(e) && r(e.toArray);
36
+ }
37
+ function w(e) {
38
+ if (!c(e) || o(e)) return !1;
39
+ let t = r(e.toJson), n = r(e.toJSON);
40
+ return t || n;
41
+ }
42
+ function T(e) {
43
+ return c(e) && !o(e) && r(e.jsonSerialize);
44
+ }
45
+ function E(t) {
46
+ return e(t) ? t : null;
47
+ }
48
+ function D(e) {
49
+ return Array.isArray(e) ? e.slice() : null;
50
+ }
51
+ function O(e) {
52
+ return D(e) || [];
53
+ }
54
+ function k(e) {
55
+ if (u(e) || !c(e)) return e;
56
+ for (let t of [
57
+ "all",
58
+ "toArray",
59
+ "toJSON"
60
+ ]) if (r(e[t])) return k(e[t]());
61
+ return e;
62
+ }
63
+ function A(t) {
64
+ let n = k(t);
65
+ return o(n) || d(n) ? [] : e(n) ? n.slice() : c(n) ? a(n) ? v(n).map(([, e]) => e) : i(n) ? [...n] : Object.values(n) : [n];
66
+ }
67
+ function j(t) {
68
+ let n = k(t);
69
+ if (o(n) || d(n)) return {};
70
+ if (e(n)) return { ...n };
71
+ if (c(n)) {
72
+ if (a(n)) {
73
+ let e = {};
74
+ for (let [t, r] of v(n)) h(e, t, r);
75
+ return e;
76
+ }
77
+ return f(n) || p(n) ? {} : i(n) ? { ...[...n] } : n;
78
+ }
79
+ return { 0: n };
80
+ }
81
+ function M(e) {
82
+ return o(e) || d(e) ? "" : t(e) ? e ? "1" : "" : String(e);
83
+ }
84
+ function N(e, t) {
85
+ if (!n(e) || e < -(2 ** 63) || e >= 2 ** 63) throw TypeError(t);
86
+ return Math.trunc(e);
87
+ }
88
+ function P(e) {
89
+ if (!n(e)) return 0;
90
+ let t = Math.trunc(e);
91
+ return t >= -(2 ** 63) && t < 2 ** 63 ? t === 0 ? 0 : t : Number(BigInt.asIntN(64, BigInt(t)));
92
+ }
93
+ function F(e) {
94
+ if (l(e)) return "Array";
95
+ if (g(e)) return String(e.toString());
96
+ if (c(e) || r(e)) throw Error(`Object of class ${m(e)} could not be converted to string`);
97
+ return b(e);
98
+ }
99
+ export { j as arrayableItems, A as arrayableValues, E as castableToArray, M as cssListItemToString, O as getAccessibleValues, D as normalizeToArray, N as phpIntArgument, P as phpIntCast, F as phpStringCast, C as toArrayable, T as toJsonSerializable, w as toJsonable, b as toPhpKeyString };
package/dist/equality.js CHANGED
@@ -1,211 +1,156 @@
1
- import { isNumber as T, isString as u, isPhpNumeric as y, isBoolean as N, isObject as m, isPlainObject as V, isArray as B, isPhpFalsy as H, isNull as R, isUndefined as U } from "./guards.js";
2
- function g(t) {
3
- return R(t) || U(t);
4
- }
5
- function h(t, r) {
6
- return t < r ? -1 : t > r ? 1 : 0;
7
- }
8
- const j = /^[ \t\n\r\v\f]*[+-]?\d+[ \t\n\r\v\f]*$/, A = 2 ** 63, k = 2n ** 63n;
9
- function S(t) {
10
- return t >= k ? 1 : t < -k ? -1 : 0;
11
- }
12
- function D(t, r) {
13
- if (j.test(t) && j.test(r)) {
14
- const e = BigInt(t), i = BigInt(r), s = S(e);
15
- return s !== 0 && s === S(i) && Number(t) === Number(r) ? h(t, r) : e < i ? -1 : e > i ? 1 : 0;
16
- }
17
- const n = Number(t), o = Number(r);
18
- return n === o && !Number.isFinite(n) ? h(t, r) : n < o ? -1 : n > o ? 1 : 0;
19
- }
20
- function p(t) {
21
- return !H(t);
22
- }
23
- function _(t, r) {
24
- return G(t, r, void 0);
25
- }
26
- function G(t, r, n) {
27
- if (g(t) && u(r))
28
- return h("", r);
29
- if (u(t) && g(r))
30
- return h(t, "");
31
- if (g(t) || g(r) || N(t) || N(r)) {
32
- const e = p(t), i = p(r);
33
- return e === i ? 0 : e ? 1 : -1;
34
- }
35
- if (t instanceof Date && r instanceof Date) {
36
- const e = t.getTime(), i = r.getTime();
37
- return e < i ? -1 : e > i ? 1 : 0;
38
- }
39
- if (typeof t == "object" && typeof r == "object")
40
- return q(t, r, n ?? /* @__PURE__ */ new Map());
41
- if ((typeof t == "number" || u(t)) && (typeof r == "number" || u(r)) && (Number.isNaN(t) || Number.isNaN(r)))
42
- return 1;
43
- if (y(t) && y(r)) {
44
- if (u(t) && u(r))
45
- return D(t, r);
46
- const e = Number(t), i = Number(r);
47
- return e < i ? -1 : e > i ? 1 : 0;
48
- }
49
- return u(t) || u(r) ? h(String(t), String(r)) : t < r ? -1 : t > r ? 1 : 0;
50
- }
51
- function q(t, r, n) {
52
- const o = n.get(t);
53
- if (o?.has(r))
54
- return 0;
55
- const e = o ?? /* @__PURE__ */ new Set();
56
- o || n.set(t, e), e.add(r);
57
- const i = C(t, r, n);
58
- return e.delete(r), i;
59
- }
60
- function C(t, r, n) {
61
- const o = Object.keys(t), e = Object.keys(r).length;
62
- if (o.length !== e)
63
- return o.length < e ? -1 : 1;
64
- const i = t, s = r;
65
- for (const f of o) {
66
- if (!Object.hasOwn(r, f))
67
- return 1;
68
- const l = G(i[f], s[f], n);
69
- if (l !== 0)
70
- return l;
71
- }
72
- return 0;
73
- }
74
- function I(t, r) {
75
- if (t === r)
76
- return !0;
77
- if (T(t) && T(r))
78
- return !1;
79
- if (u(t) && u(r))
80
- return y(t) && y(r) && D(t, r) === 0;
81
- const n = g(t), o = g(r);
82
- if (n && o)
83
- return !0;
84
- if (n || o) {
85
- const s = n ? r : t;
86
- return u(s) ? s === "" : !p(s);
87
- }
88
- if (N(t) || N(r))
89
- return p(t) === p(r);
90
- if (P(t) || P(r))
91
- return !1;
92
- if (u(t) !== u(r)) {
93
- const s = u(t) ? r : t;
94
- if (m(s) && !V(s) && x(s))
95
- return String(s) === (u(t) ? t : r);
96
- }
97
- const e = E(t) || u(t), i = E(r) || u(r);
98
- if (e && i)
99
- return d(t) && d(r) ? w(t) && w(r) ? BigInt(t) === BigInt(r) : Number(t) === Number(r) : F(t) === F(r);
100
- if (B(t) && B(r)) {
101
- if (t.length !== r.length)
102
- return !1;
103
- for (let s = 0; s < t.length; s++)
104
- if (!I(t[s], r[s]))
105
- return !1;
106
- return !0;
107
- }
108
- if (m(t) && m(r)) {
109
- const s = Object.keys(t), f = Object.keys(r);
110
- return s.length !== f.length ? !1 : s.every(
111
- (l) => f.includes(l) && I(
112
- t[l],
113
- r[l]
114
- )
115
- );
116
- }
117
- return !1;
118
- }
119
- function E(t) {
120
- return typeof t == "number" || typeof t == "bigint";
121
- }
122
- function d(t) {
123
- return typeof t == "bigint" || y(t);
124
- }
125
- function w(t) {
126
- return typeof t == "bigint" ? !0 : typeof t == "number" ? Number.isInteger(t) && t >= -A && t < A : j.test(t) && S(BigInt(t)) === 0;
127
- }
128
- function P(t) {
129
- return typeof t == "number" && Number.isNaN(t);
130
- }
131
- function x(t) {
132
- const r = t.toString;
133
- return typeof r == "function" && r !== Object.prototype.toString;
134
- }
135
- function F(t) {
136
- if (typeof t == "number") {
137
- if (t === Number.POSITIVE_INFINITY)
138
- return "INF";
139
- if (t === Number.NEGATIVE_INFINITY)
140
- return "-INF";
141
- }
142
- return String(t);
143
- }
144
- function O(t, r) {
145
- if (t === r)
146
- return !0;
147
- if (Array.isArray(t) && Array.isArray(r)) {
148
- if (t.length !== r.length)
149
- return !1;
150
- for (let n = 0; n < t.length; n++)
151
- if (!O(t[n], r[n]))
152
- return !1;
153
- return !0;
154
- }
155
- if (t !== null && r !== null && typeof t == "object" && typeof r == "object" && !Array.isArray(t) && !Array.isArray(r)) {
156
- const n = t.constructor === Object || t.constructor === void 0, o = r.constructor === Object || r.constructor === void 0;
157
- if (!n || !o)
158
- return !1;
159
- const e = Object.keys(t), i = Object.keys(r);
160
- if (e.length !== i.length)
161
- return !1;
162
- for (const [s, f] of e.entries())
163
- if (f !== i[s] || !O(
164
- t[f],
165
- r[f]
166
- ))
167
- return !1;
168
- return !0;
169
- }
170
- return !1;
171
- }
172
- function Y(t, r, n) {
173
- const o = [t, n], e = (c) => m(c) && !V(c);
174
- if (o.filter(
175
- (c) => u(c) || e(c) && x(c)
176
- ).length < 2 && o.filter(e).length === 1)
177
- return ["!=", "<>", "!=="].includes(r);
178
- const f = !(N(t) || N(n) || g(t) || g(n)) && (P(t) || P(n)), l = (c) => !f && c(_(t, n));
179
- switch (r) {
180
- case "!=":
181
- case "<>":
182
- return !I(t, n);
183
- case "<":
184
- return l((c) => c < 0);
185
- case ">":
186
- return l((c) => c > 0);
187
- case "<=":
188
- return l((c) => c <= 0);
189
- case ">=":
190
- return l((c) => c >= 0);
191
- // PHP's `===` compares an array by value — same keys, same order, same types — and only a real object by
192
- // identity. strictEqual is that rule; JS's own `===` would call every pair of equal arrays unequal
193
- // (docs/php-parity/Collection/contains.json, "r4-strict-operators").
194
- case "===":
195
- return O(t, n);
196
- case "!==":
197
- return !O(t, n);
198
- // PHP's `<=>` is truthy for any non-zero result, so only an equal pair is
199
- // falsy; an uncomparable one answers 1, not 0, and so counts as unequal.
200
- case "<=>":
201
- return f || _(t, n) !== 0;
202
- default:
203
- return I(t, n);
204
- }
205
- }
206
- export {
207
- _ as compareValues,
208
- I as looseEqual,
209
- Y as operatorMatch,
210
- O as strictEqual
211
- };
1
+ import { isArray as e, isBoolean as t, isNull as n, isNumber as r, isObject as i, isPhpFalsy as a, isPhpNumeric as o, isPlainObject as s, isString as c, isUndefined as l } from "./guards.js";
2
+ // src/equality.ts
3
+ function u(e) {
4
+ return n(e) || l(e);
5
+ }
6
+ function d(e, t) {
7
+ return e < t ? -1 : +(e > t);
8
+ }
9
+ var f = /^[ \t\n\r\v\f]*[+-]?\d+[ \t\n\r\v\f]*$/, p = 2 ** 63, m = 2n ** 63n;
10
+ function h(e) {
11
+ return e >= m ? 1 : e < -m ? -1 : 0;
12
+ }
13
+ function g(e, t) {
14
+ if (f.test(e) && f.test(t)) {
15
+ let n = BigInt(e), r = BigInt(t), i = h(n);
16
+ return i !== 0 && i === h(r) && Number(e) === Number(t) ? d(e, t) : n < r ? -1 : +(n > r);
17
+ }
18
+ let n = Number(e), r = Number(t);
19
+ return n === r && !Number.isFinite(n) ? d(e, t) : n < r ? -1 : +(n > r);
20
+ }
21
+ function _(e) {
22
+ return !a(e);
23
+ }
24
+ function v(e, t) {
25
+ return y(e, t, void 0);
26
+ }
27
+ function y(e, n, r) {
28
+ if (u(e) && c(n)) return d("", n);
29
+ if (c(e) && u(n)) return d(e, "");
30
+ if (u(e) || u(n) || t(e) || t(n)) {
31
+ let t = _(e);
32
+ return t === _(n) ? 0 : t ? 1 : -1;
33
+ }
34
+ if (e instanceof Date && n instanceof Date) {
35
+ let t = e.getTime(), r = n.getTime();
36
+ return t < r ? -1 : +(t > r);
37
+ }
38
+ if (typeof e == "object" && typeof n == "object") return b(e, n, r ?? /* @__PURE__ */ new Map());
39
+ if ((typeof e == "number" || c(e)) && (typeof n == "number" || c(n)) && (Number.isNaN(e) || Number.isNaN(n))) return 1;
40
+ if (o(e) && o(n)) {
41
+ if (c(e) && c(n)) return g(e, n);
42
+ let t = Number(e), r = Number(n);
43
+ return t < r ? -1 : +(t > r);
44
+ }
45
+ return c(e) || c(n) ? d(String(e), String(n)) : e < n ? -1 : +(e > n);
46
+ }
47
+ function b(e, t, n) {
48
+ let r = n.get(e);
49
+ if (r?.has(t)) return 0;
50
+ let i = r ?? /* @__PURE__ */ new Set();
51
+ r || n.set(e, i), i.add(t);
52
+ let a = x(e, t, n);
53
+ return i.delete(t), a;
54
+ }
55
+ function x(e, t, n) {
56
+ let r = Object.keys(e), i = Object.keys(t).length;
57
+ if (r.length !== i) return r.length < i ? -1 : 1;
58
+ let a = e, o = t;
59
+ for (let e of r) {
60
+ if (!Object.hasOwn(t, e)) return 1;
61
+ let r = y(a[e], o[e], n);
62
+ if (r !== 0) return r;
63
+ }
64
+ return 0;
65
+ }
66
+ function S(n, a) {
67
+ if (n === a) return !0;
68
+ if (r(n) && r(a)) return !1;
69
+ if (c(n) && c(a)) return o(n) && o(a) && g(n, a) === 0;
70
+ let l = u(n), d = u(a);
71
+ if (l && d) return !0;
72
+ if (l || d) {
73
+ let e = l ? a : n;
74
+ return c(e) ? e === "" : !_(e);
75
+ }
76
+ if (t(n) || t(a)) return _(n) === _(a);
77
+ if (E(n) || E(a)) return !1;
78
+ if (c(n) !== c(a)) {
79
+ let e = c(n) ? a : n;
80
+ if (i(e) && !s(e) && D(e)) return String(e) === (c(n) ? n : a);
81
+ }
82
+ let f = C(n) || c(n), p = C(a) || c(a);
83
+ if (f && p) return w(n) && w(a) ? T(n) && T(a) ? BigInt(n) === BigInt(a) : Number(n) === Number(a) : O(n) === O(a);
84
+ if (e(n) && e(a)) {
85
+ if (n.length !== a.length) return !1;
86
+ for (let e = 0; e < n.length; e++) if (!S(n[e], a[e])) return !1;
87
+ return !0;
88
+ }
89
+ if (i(n) && i(a)) {
90
+ let e = Object.keys(n), t = Object.keys(a);
91
+ return e.length === t.length && e.every((e) => t.includes(e) && S(n[e], a[e]));
92
+ }
93
+ return !1;
94
+ }
95
+ function C(e) {
96
+ return typeof e == "number" || typeof e == "bigint";
97
+ }
98
+ function w(e) {
99
+ return typeof e == "bigint" || o(e);
100
+ }
101
+ function T(e) {
102
+ return typeof e == "bigint" ? !0 : typeof e == "number" ? Number.isInteger(e) && e >= -p && e < p : f.test(e) && h(BigInt(e)) === 0;
103
+ }
104
+ function E(e) {
105
+ return typeof e == "number" && Number.isNaN(e);
106
+ }
107
+ function D(e) {
108
+ let t = e.toString;
109
+ return typeof t == "function" && t !== Object.prototype.toString;
110
+ }
111
+ function O(e) {
112
+ if (typeof e == "number") {
113
+ if (e === Infinity) return "INF";
114
+ if (e === -Infinity) return "-INF";
115
+ }
116
+ return String(e);
117
+ }
118
+ function k(e, t) {
119
+ if (e === t) return !0;
120
+ if (Array.isArray(e) && Array.isArray(t)) {
121
+ if (e.length !== t.length) return !1;
122
+ for (let n = 0; n < e.length; n++) if (!k(e[n], t[n])) return !1;
123
+ return !0;
124
+ }
125
+ if (e !== null && t !== null && typeof e == "object" && typeof t == "object" && !Array.isArray(e) && !Array.isArray(t)) {
126
+ let n = e.constructor === Object || e.constructor === void 0, r = t.constructor === Object || t.constructor === void 0;
127
+ if (!n || !r) return !1;
128
+ let i = Object.keys(e), a = Object.keys(t);
129
+ if (i.length !== a.length) return !1;
130
+ for (let [n, r] of i.entries()) if (r !== a[n] || !k(e[r], t[r])) return !1;
131
+ return !0;
132
+ }
133
+ return !1;
134
+ }
135
+ function A(e, n, r) {
136
+ let a = [e, r], o = (e) => i(e) && !s(e);
137
+ if (a.filter((e) => c(e) || o(e) && D(e)).length < 2 && a.filter(o).length === 1) return [
138
+ "!=",
139
+ "<>",
140
+ "!=="
141
+ ].includes(n);
142
+ let l = !(t(e) || t(r) || u(e) || u(r)) && (E(e) || E(r)), d = (t) => !l && t(v(e, r));
143
+ switch (n) {
144
+ case "!=":
145
+ case "<>": return !S(e, r);
146
+ case "<": return d((e) => e < 0);
147
+ case ">": return d((e) => e > 0);
148
+ case "<=": return d((e) => e <= 0);
149
+ case ">=": return d((e) => e >= 0);
150
+ case "===": return k(e, r);
151
+ case "!==": return !k(e, r);
152
+ case "<=>": return l || v(e, r) !== 0;
153
+ default: return S(e, r);
154
+ }
155
+ }
156
+ export { v as compareValues, S as looseEqual, A as operatorMatch, k as strictEqual };