es-toolkit 1.9.0-dev.197 → 1.9.0-dev.198
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/array/index.mjs +33 -33
- package/dist/chunk-ASJF5D6C.mjs +1 -0
- package/dist/chunk-JYSV56US.mjs +41 -0
- package/dist/chunk-JYSV56US.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -67
- package/dist/math/index.mjs +3 -3
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +45 -0
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +10 -4
- package/dist/predicate/isEqual.d.mts +17 -0
- package/dist/predicate/isEqual.d.ts +17 -0
- package/dist/predicate/isEqual.js +73 -0
- package/dist/predicate/isEqual.js.map +1 -0
- package/dist/predicate/isEqual.mjs +10 -0
- package/dist/predicate/isEqual.mjs.map +1 -0
- package/dist/string/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-MAJSPFA6.mjs +0 -1
- /package/dist/{chunk-MAJSPFA6.mjs.map → chunk-ASJF5D6C.mjs.map} +0 -0
package/dist/array/index.mjs
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import "../chunk-2MRZANXZ.mjs";
|
|
2
|
-
import {
|
|
3
|
-
xorBy
|
|
4
|
-
} from "../chunk-Q47NGNXT.mjs";
|
|
5
|
-
import {
|
|
6
|
-
xorWith
|
|
7
|
-
} from "../chunk-QRSJBBFY.mjs";
|
|
8
2
|
import {
|
|
9
3
|
zip
|
|
10
4
|
} from "../chunk-IDCUZVJL.mjs";
|
|
@@ -14,15 +8,9 @@ import {
|
|
|
14
8
|
import {
|
|
15
9
|
zipWith
|
|
16
10
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
17
|
-
import {
|
|
18
|
-
unionWith
|
|
19
|
-
} from "../chunk-2ZCITDMK.mjs";
|
|
20
11
|
import {
|
|
21
12
|
uniqBy
|
|
22
13
|
} from "../chunk-OXAZEEGP.mjs";
|
|
23
|
-
import {
|
|
24
|
-
uniqWith
|
|
25
|
-
} from "../chunk-237HGSZS.mjs";
|
|
26
14
|
import {
|
|
27
15
|
unzip
|
|
28
16
|
} from "../chunk-UYZKMBDO.mjs";
|
|
@@ -36,11 +24,11 @@ import {
|
|
|
36
24
|
xor
|
|
37
25
|
} from "../chunk-L7FQX5MN.mjs";
|
|
38
26
|
import {
|
|
39
|
-
|
|
40
|
-
} from "../chunk-
|
|
27
|
+
xorBy
|
|
28
|
+
} from "../chunk-Q47NGNXT.mjs";
|
|
41
29
|
import {
|
|
42
|
-
|
|
43
|
-
} from "../chunk-
|
|
30
|
+
xorWith
|
|
31
|
+
} from "../chunk-QRSJBBFY.mjs";
|
|
44
32
|
import {
|
|
45
33
|
takeRight
|
|
46
34
|
} from "../chunk-IQLKIDXF.mjs";
|
|
@@ -56,18 +44,18 @@ import {
|
|
|
56
44
|
import {
|
|
57
45
|
union
|
|
58
46
|
} from "../chunk-R6QA7PLZ.mjs";
|
|
59
|
-
import {
|
|
60
|
-
uniq
|
|
61
|
-
} from "../chunk-DVK2N4KC.mjs";
|
|
62
47
|
import {
|
|
63
48
|
unionBy
|
|
64
49
|
} from "../chunk-NFS7RWWE.mjs";
|
|
65
50
|
import {
|
|
66
|
-
|
|
67
|
-
} from "../chunk-
|
|
51
|
+
unionWith
|
|
52
|
+
} from "../chunk-2ZCITDMK.mjs";
|
|
68
53
|
import {
|
|
69
|
-
|
|
70
|
-
} from "../chunk-
|
|
54
|
+
uniqWith
|
|
55
|
+
} from "../chunk-237HGSZS.mjs";
|
|
56
|
+
import {
|
|
57
|
+
uniq
|
|
58
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
71
59
|
import {
|
|
72
60
|
minBy
|
|
73
61
|
} from "../chunk-IJD7FE2Z.mjs";
|
|
@@ -83,15 +71,17 @@ import {
|
|
|
83
71
|
import {
|
|
84
72
|
sampleSize
|
|
85
73
|
} from "../chunk-EHSKB6DF.mjs";
|
|
74
|
+
import "../chunk-GIWAOOFY.mjs";
|
|
75
|
+
import "../chunk-SYWMYQYJ.mjs";
|
|
86
76
|
import {
|
|
87
77
|
shuffle
|
|
88
78
|
} from "../chunk-G7UQ5PUR.mjs";
|
|
89
79
|
import {
|
|
90
|
-
|
|
91
|
-
} from "../chunk-
|
|
80
|
+
tail
|
|
81
|
+
} from "../chunk-OF6NM4G7.mjs";
|
|
92
82
|
import {
|
|
93
|
-
|
|
94
|
-
} from "../chunk-
|
|
83
|
+
take
|
|
84
|
+
} from "../chunk-ME352XO7.mjs";
|
|
95
85
|
import {
|
|
96
86
|
initial
|
|
97
87
|
} from "../chunk-XPSOKBRZ.mjs";
|
|
@@ -108,11 +98,11 @@ import {
|
|
|
108
98
|
keyBy
|
|
109
99
|
} from "../chunk-AJKZMN2V.mjs";
|
|
110
100
|
import {
|
|
111
|
-
|
|
112
|
-
} from "../chunk-
|
|
101
|
+
last
|
|
102
|
+
} from "../chunk-KPBQ7OUY.mjs";
|
|
113
103
|
import {
|
|
114
|
-
|
|
115
|
-
} from "../chunk-
|
|
104
|
+
maxBy
|
|
105
|
+
} from "../chunk-OOKNBU4V.mjs";
|
|
116
106
|
import {
|
|
117
107
|
dropRightWhile
|
|
118
108
|
} from "../chunk-JE6JKZU3.mjs";
|
|
@@ -131,6 +121,12 @@ import {
|
|
|
131
121
|
import {
|
|
132
122
|
forEachRight
|
|
133
123
|
} from "../chunk-IEA53J7P.mjs";
|
|
124
|
+
import {
|
|
125
|
+
groupBy
|
|
126
|
+
} from "../chunk-E6E4RZLN.mjs";
|
|
127
|
+
import {
|
|
128
|
+
head
|
|
129
|
+
} from "../chunk-HM2JT2RX.mjs";
|
|
134
130
|
import {
|
|
135
131
|
chunk
|
|
136
132
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -149,8 +145,12 @@ import {
|
|
|
149
145
|
import {
|
|
150
146
|
differenceWith
|
|
151
147
|
} from "../chunk-6NVQAHXP.mjs";
|
|
152
|
-
import
|
|
153
|
-
|
|
148
|
+
import {
|
|
149
|
+
drop
|
|
150
|
+
} from "../chunk-S3CORED5.mjs";
|
|
151
|
+
import {
|
|
152
|
+
dropRight
|
|
153
|
+
} from "../chunk-JEKUA56R.mjs";
|
|
154
154
|
import "../chunk-2HIMLZE3.mjs";
|
|
155
155
|
export {
|
|
156
156
|
chunk,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-ASJF5D6C.mjs.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
union
|
|
3
|
+
} from "./chunk-R6QA7PLZ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/predicate/isEqual.ts
|
|
6
|
+
function isEqual(a, b) {
|
|
7
|
+
if (Object.is(a, b)) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (a instanceof Date && b instanceof Date) {
|
|
11
|
+
return a.getTime() === b.getTime();
|
|
12
|
+
}
|
|
13
|
+
if (a instanceof RegExp && b instanceof RegExp) {
|
|
14
|
+
return a.source === b.source && a.flags === b.flags;
|
|
15
|
+
}
|
|
16
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const aKeys = Object.keys(a);
|
|
20
|
+
const bKeys = Object.keys(b);
|
|
21
|
+
if (aKeys.length !== bKeys.length) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (union(aKeys, bKeys).length !== aKeys.length) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
for (let i = 0; i < aKeys.length; i++) {
|
|
28
|
+
const propKey = aKeys[i];
|
|
29
|
+
const aProp = a[propKey];
|
|
30
|
+
const bProp = b[propKey];
|
|
31
|
+
if (!isEqual(aProp, bProp)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
isEqual
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-JYSV56US.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/predicate/isEqual.ts"],"sourcesContent":["import { union } from \"../array/union.ts\";\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @param {unknown} a - The first value to compare.\n * @param {unknown} b - The second value to compare.\n * @returns {boolean} `true` if the values are equal, otherwise `false`.\n *\n * @example\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n\n const aKeys = Object.keys(a as object);\n const bKeys = Object.keys(b as object);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n // check if all keys in both arrays match\n if (union(aKeys, bKeys).length !== aKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const propKey = aKeys[i];\n const aProp = (a as any)[propKey];\n const bProp = (b as any)[propKey];\n \n if (!isEqual(aProp, bProp)) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";;;;;AAgBO,SAAS,QAAQ,GAAY,GAAqB;AACvD,MAAI,OAAO,GAAG,GAAG,CAAC,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,QAAQ,aAAa,MAAM;AAC1C,WAAO,EAAE,QAAQ,MAAM,EAAE,QAAQ;AAAA,EACnC;AAEA,MAAI,aAAa,UAAU,aAAa,QAAQ;AAC9C,WAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;AAAA,EAChD;AAEA,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC9E,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,OAAO,KAAK,CAAW;AACrC,QAAM,QAAQ,OAAO,KAAK,CAAW;AAErC,MAAI,MAAM,WAAW,MAAM,QAAQ;AACjC,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,OAAO,KAAK,EAAE,WAAW,MAAM,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,UAAU,MAAM,CAAC;AACvB,UAAM,QAAS,EAAU,OAAO;AAChC,UAAM,QAAS,EAAU,OAAO;AAEhC,QAAI,CAAC,QAAQ,OAAO,KAAK,GAAG;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -68,6 +68,7 @@ export { pick } from './object/pick.mjs';
|
|
|
68
68
|
export { pickBy } from './object/pickBy.mjs';
|
|
69
69
|
export { invert } from './object/invert.mjs';
|
|
70
70
|
export { clone } from './object/clone.mjs';
|
|
71
|
+
export { isEqual } from './predicate/isEqual.mjs';
|
|
71
72
|
export { isNil } from './predicate/isNil.mjs';
|
|
72
73
|
export { isNotNil } from './predicate/isNotNil.mjs';
|
|
73
74
|
export { isNull } from './predicate/isNull.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export { pick } from './object/pick.js';
|
|
|
68
68
|
export { pickBy } from './object/pickBy.js';
|
|
69
69
|
export { invert } from './object/invert.js';
|
|
70
70
|
export { clone } from './object/clone.js';
|
|
71
|
+
export { isEqual } from './predicate/isEqual.js';
|
|
71
72
|
export { isNil } from './predicate/isNil.js';
|
|
72
73
|
export { isNotNil } from './predicate/isNotNil.js';
|
|
73
74
|
export { isNull } from './predicate/isNull.js';
|
package/dist/index.js
CHANGED
|
@@ -4128,7 +4128,7 @@ var require_lodash = __commonJS({
|
|
|
4128
4128
|
}
|
|
4129
4129
|
return true;
|
|
4130
4130
|
}
|
|
4131
|
-
function
|
|
4131
|
+
function isEqual2(value, other) {
|
|
4132
4132
|
return baseIsEqual(value, other);
|
|
4133
4133
|
}
|
|
4134
4134
|
function isEqualWith(value, other, customizer) {
|
|
@@ -5241,7 +5241,7 @@ var require_lodash = __commonJS({
|
|
|
5241
5241
|
lodash.isDate = isDate;
|
|
5242
5242
|
lodash.isElement = isElement;
|
|
5243
5243
|
lodash.isEmpty = isEmpty;
|
|
5244
|
-
lodash.isEqual =
|
|
5244
|
+
lodash.isEqual = isEqual2;
|
|
5245
5245
|
lodash.isEqualWith = isEqualWith;
|
|
5246
5246
|
lodash.isError = isError;
|
|
5247
5247
|
lodash.isFinite = isFinite;
|
|
@@ -5557,6 +5557,7 @@ __export(src_exports, {
|
|
|
5557
5557
|
intersectionBy: () => intersectionBy,
|
|
5558
5558
|
intersectionWith: () => intersectionWith,
|
|
5559
5559
|
invert: () => invert,
|
|
5560
|
+
isEqual: () => isEqual,
|
|
5560
5561
|
isNil: () => isNil,
|
|
5561
5562
|
isNotNil: () => isNotNil,
|
|
5562
5563
|
isNull: () => isNull,
|
|
@@ -6349,6 +6350,39 @@ function isPrimitive(value) {
|
|
|
6349
6350
|
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
6350
6351
|
}
|
|
6351
6352
|
|
|
6353
|
+
// src/predicate/isEqual.ts
|
|
6354
|
+
function isEqual(a, b) {
|
|
6355
|
+
if (Object.is(a, b)) {
|
|
6356
|
+
return true;
|
|
6357
|
+
}
|
|
6358
|
+
if (a instanceof Date && b instanceof Date) {
|
|
6359
|
+
return a.getTime() === b.getTime();
|
|
6360
|
+
}
|
|
6361
|
+
if (a instanceof RegExp && b instanceof RegExp) {
|
|
6362
|
+
return a.source === b.source && a.flags === b.flags;
|
|
6363
|
+
}
|
|
6364
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
|
|
6365
|
+
return false;
|
|
6366
|
+
}
|
|
6367
|
+
const aKeys = Object.keys(a);
|
|
6368
|
+
const bKeys = Object.keys(b);
|
|
6369
|
+
if (aKeys.length !== bKeys.length) {
|
|
6370
|
+
return false;
|
|
6371
|
+
}
|
|
6372
|
+
if (union(aKeys, bKeys).length !== aKeys.length) {
|
|
6373
|
+
return false;
|
|
6374
|
+
}
|
|
6375
|
+
for (let i = 0; i < aKeys.length; i++) {
|
|
6376
|
+
const propKey = aKeys[i];
|
|
6377
|
+
const aProp = a[propKey];
|
|
6378
|
+
const bProp = b[propKey];
|
|
6379
|
+
if (!isEqual(aProp, bProp)) {
|
|
6380
|
+
return false;
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
return true;
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6352
6386
|
// src/predicate/isNil.ts
|
|
6353
6387
|
function isNil(x) {
|
|
6354
6388
|
return x == null;
|
|
@@ -6460,6 +6494,7 @@ var capitalize2 = (str) => {
|
|
|
6460
6494
|
intersectionBy,
|
|
6461
6495
|
intersectionWith,
|
|
6462
6496
|
invert,
|
|
6497
|
+
isEqual,
|
|
6463
6498
|
isNil,
|
|
6464
6499
|
isNotNil,
|
|
6465
6500
|
isNull,
|