es-toolkit 1.36.0 → 1.37.0
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/CHANGELOG.md +15 -0
- package/dist/_chunk/isPlainObject-Xaozpc.js +93 -0
- package/dist/_chunk/{isPromise-CxqI1v.js → isWeakSet-C2NpfO.js} +91 -177
- package/dist/_chunk/snakeCase-BwvoPi.js +30 -0
- package/dist/_chunk/toSnakeCaseKeys-kqZCyq.js +379 -0
- package/dist/_chunk/{reverseString-BixeGz.js → upperFirst-DbrFSz.js} +19 -45
- package/dist/_chunk/{zip-BJSrRi.js → zip-DDfXXG.js} +0 -24
- package/dist/array/index.js +25 -4
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/compareValues.mjs +0 -3
- package/dist/compat/array/sampleSize.d.mts +38 -0
- package/dist/compat/array/sampleSize.d.ts +38 -0
- package/dist/compat/array/sampleSize.mjs +18 -0
- package/dist/compat/array/unzipWith.d.mts +78 -0
- package/dist/compat/array/unzipWith.d.ts +78 -0
- package/dist/compat/array/unzipWith.mjs +21 -0
- package/dist/compat/array/xor.d.mts +23 -0
- package/dist/compat/array/xor.d.ts +23 -0
- package/dist/compat/array/xor.mjs +30 -0
- package/dist/compat/compat.d.mts +6 -4
- package/dist/compat/compat.d.ts +6 -4
- package/dist/compat/compat.mjs +7 -5
- package/dist/compat/index.d.mts +6 -4
- package/dist/compat/index.d.ts +6 -4
- package/dist/compat/index.js +4678 -309
- package/dist/compat/index.mjs +7 -5
- package/dist/compat/object/omitBy.d.mts +22 -0
- package/dist/compat/object/omitBy.d.ts +22 -0
- package/dist/compat/object/omitBy.mjs +26 -0
- package/dist/compat/object/result.d.mts +33 -0
- package/dist/compat/object/result.d.ts +33 -0
- package/dist/compat/object/result.mjs +24 -0
- package/dist/compat/object/transform.d.mts +59 -0
- package/dist/compat/object/transform.d.ts +59 -0
- package/dist/compat/object/transform.mjs +30 -0
- package/dist/compat/util/toString.mjs +3 -0
- package/dist/index.js +71 -69
- package/dist/object/index.js +28 -15
- package/dist/object/toCamelCaseKeys.mjs +2 -12
- package/dist/object/toSnakeCaseKeys.mjs +1 -11
- package/dist/predicate/index.js +31 -30
- package/dist/string/index.js +23 -22
- package/package.json +1 -1
- package/dist/_chunk/toSnakeCaseKeys-DZO2eB.js +0 -4901
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
# es-toolkit Changelog
|
|
2
|
+
|
|
3
|
+
## Version v1.37.0
|
|
4
|
+
|
|
5
|
+
Released on May 3rd, 2025.
|
|
6
|
+
|
|
7
|
+
- Introduced compatibility functions for [result](https://es-toolkit.slash.page/reference/compat/object/result.html), [omitBy](https://es-toolkit.slash.page/reference/object/omitBy.html), [xorBy](https://es-toolkit.slash.page/reference/array/xorBy.html), [xorWith](https://es-toolkit.slash.page/reference/array/xorWith.html), [unzipWith](https://es-toolkit.slash.page/reference/array/unzipWith.html), [sampleSize](https://es-toolkit.slash.page/reference/array/sampleSize.html), [transform](https://es-toolkit.slash.page/reference/compat/object/transform.html), [wrap](https://es-toolkit.slash.page/reference/compat/function/wrap.html), [countBy](https://es-toolkit.slash.page/reference/array/countBy.html), and [xor](https://es-toolkit.slash.page/reference/array/xor.html).
|
|
8
|
+
- Added vitest benchmark for [ary](https://es-toolkit.slash.page/reference/function/ary.html) function.
|
|
9
|
+
- Fixed string comparison in [sortBy](https://es-toolkit.slash.page/reference/array/sortBy.html) and [orderBy](https://es-toolkit.slash.page/reference/array/orderBy.html) by removing locale comparison and using ASCII code instead.
|
|
10
|
+
- Fixed type definition in [isBuffer](https://es-toolkit.slash.page/reference/predicate/isBuffer.html).
|
|
11
|
+
- Fixed internal documentation links for Korean and Japanese headings.
|
|
12
|
+
- Improved code readability and documentation for various functions.
|
|
13
|
+
- Prevented circular dependencies by updating import paths in [toCamelCaseKeys](https://es-toolkit.slash.page/reference/object/toCamelCaseKeys.html) and [toSnakeCaseKeys](https://es-toolkit.slash.page/reference/object/toSnakeCaseKeys.html).
|
|
14
|
+
|
|
15
|
+
We sincerely thank @chldmsqls34, @umsungjun, @raon0211, @dayongkr, @shren207, @oror-sine, @L2HYUNN, @D-Sketon, @ariandel-dev, @Jeong-Rae, and @beomxtone for their contributions. We appreciate your great efforts!
|
|
16
|
+
|
|
2
17
|
## Version v1.36.0
|
|
3
18
|
|
|
4
19
|
Released on April 24th, 2025.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function isPrimitive(value) {
|
|
4
|
+
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function isTypedArray(x) {
|
|
8
|
+
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getSymbols(object) {
|
|
12
|
+
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getTag(value) {
|
|
16
|
+
if (value == null) {
|
|
17
|
+
return value === undefined ? '[object Undefined]' : '[object Null]';
|
|
18
|
+
}
|
|
19
|
+
return Object.prototype.toString.call(value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const regexpTag = '[object RegExp]';
|
|
23
|
+
const stringTag = '[object String]';
|
|
24
|
+
const numberTag = '[object Number]';
|
|
25
|
+
const booleanTag = '[object Boolean]';
|
|
26
|
+
const argumentsTag = '[object Arguments]';
|
|
27
|
+
const symbolTag = '[object Symbol]';
|
|
28
|
+
const dateTag = '[object Date]';
|
|
29
|
+
const mapTag = '[object Map]';
|
|
30
|
+
const setTag = '[object Set]';
|
|
31
|
+
const arrayTag = '[object Array]';
|
|
32
|
+
const functionTag = '[object Function]';
|
|
33
|
+
const arrayBufferTag = '[object ArrayBuffer]';
|
|
34
|
+
const objectTag = '[object Object]';
|
|
35
|
+
const errorTag = '[object Error]';
|
|
36
|
+
const dataViewTag = '[object DataView]';
|
|
37
|
+
const uint8ArrayTag = '[object Uint8Array]';
|
|
38
|
+
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
|
39
|
+
const uint16ArrayTag = '[object Uint16Array]';
|
|
40
|
+
const uint32ArrayTag = '[object Uint32Array]';
|
|
41
|
+
const bigUint64ArrayTag = '[object BigUint64Array]';
|
|
42
|
+
const int8ArrayTag = '[object Int8Array]';
|
|
43
|
+
const int16ArrayTag = '[object Int16Array]';
|
|
44
|
+
const int32ArrayTag = '[object Int32Array]';
|
|
45
|
+
const bigInt64ArrayTag = '[object BigInt64Array]';
|
|
46
|
+
const float32ArrayTag = '[object Float32Array]';
|
|
47
|
+
const float64ArrayTag = '[object Float64Array]';
|
|
48
|
+
|
|
49
|
+
function isPlainObject(value) {
|
|
50
|
+
if (!value || typeof value !== 'object') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
const proto = Object.getPrototypeOf(value);
|
|
54
|
+
const hasObjectPrototype = proto === null ||
|
|
55
|
+
proto === Object.prototype ||
|
|
56
|
+
Object.getPrototypeOf(proto) === null;
|
|
57
|
+
if (!hasObjectPrototype) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
exports.argumentsTag = argumentsTag;
|
|
64
|
+
exports.arrayBufferTag = arrayBufferTag;
|
|
65
|
+
exports.arrayTag = arrayTag;
|
|
66
|
+
exports.bigInt64ArrayTag = bigInt64ArrayTag;
|
|
67
|
+
exports.bigUint64ArrayTag = bigUint64ArrayTag;
|
|
68
|
+
exports.booleanTag = booleanTag;
|
|
69
|
+
exports.dataViewTag = dataViewTag;
|
|
70
|
+
exports.dateTag = dateTag;
|
|
71
|
+
exports.errorTag = errorTag;
|
|
72
|
+
exports.float32ArrayTag = float32ArrayTag;
|
|
73
|
+
exports.float64ArrayTag = float64ArrayTag;
|
|
74
|
+
exports.functionTag = functionTag;
|
|
75
|
+
exports.getSymbols = getSymbols;
|
|
76
|
+
exports.getTag = getTag;
|
|
77
|
+
exports.int16ArrayTag = int16ArrayTag;
|
|
78
|
+
exports.int32ArrayTag = int32ArrayTag;
|
|
79
|
+
exports.int8ArrayTag = int8ArrayTag;
|
|
80
|
+
exports.isPlainObject = isPlainObject;
|
|
81
|
+
exports.isPrimitive = isPrimitive;
|
|
82
|
+
exports.isTypedArray = isTypedArray;
|
|
83
|
+
exports.mapTag = mapTag;
|
|
84
|
+
exports.numberTag = numberTag;
|
|
85
|
+
exports.objectTag = objectTag;
|
|
86
|
+
exports.regexpTag = regexpTag;
|
|
87
|
+
exports.setTag = setTag;
|
|
88
|
+
exports.stringTag = stringTag;
|
|
89
|
+
exports.symbolTag = symbolTag;
|
|
90
|
+
exports.uint16ArrayTag = uint16ArrayTag;
|
|
91
|
+
exports.uint32ArrayTag = uint32ArrayTag;
|
|
92
|
+
exports.uint8ArrayTag = uint8ArrayTag;
|
|
93
|
+
exports.uint8ClampedArrayTag = uint8ClampedArrayTag;
|
|
@@ -1,107 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const isPlainObject = require('./isPlainObject-Xaozpc.js');
|
|
3
4
|
const noop = require('./noop-2IwLUk.js');
|
|
4
5
|
|
|
5
|
-
function
|
|
6
|
-
return value
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function isTypedArray(x) {
|
|
10
|
-
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function getSymbols(object) {
|
|
14
|
-
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getTag(value) {
|
|
18
|
-
if (value == null) {
|
|
19
|
-
return value === undefined ? '[object Undefined]' : '[object Null]';
|
|
20
|
-
}
|
|
21
|
-
return Object.prototype.toString.call(value);
|
|
6
|
+
function isArrayBuffer(value) {
|
|
7
|
+
return value instanceof ArrayBuffer;
|
|
22
8
|
}
|
|
23
9
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const numberTag = '[object Number]';
|
|
27
|
-
const booleanTag = '[object Boolean]';
|
|
28
|
-
const argumentsTag = '[object Arguments]';
|
|
29
|
-
const symbolTag = '[object Symbol]';
|
|
30
|
-
const dateTag = '[object Date]';
|
|
31
|
-
const mapTag = '[object Map]';
|
|
32
|
-
const setTag = '[object Set]';
|
|
33
|
-
const arrayTag = '[object Array]';
|
|
34
|
-
const functionTag = '[object Function]';
|
|
35
|
-
const arrayBufferTag = '[object ArrayBuffer]';
|
|
36
|
-
const objectTag = '[object Object]';
|
|
37
|
-
const errorTag = '[object Error]';
|
|
38
|
-
const dataViewTag = '[object DataView]';
|
|
39
|
-
const uint8ArrayTag = '[object Uint8Array]';
|
|
40
|
-
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
|
41
|
-
const uint16ArrayTag = '[object Uint16Array]';
|
|
42
|
-
const uint32ArrayTag = '[object Uint32Array]';
|
|
43
|
-
const bigUint64ArrayTag = '[object BigUint64Array]';
|
|
44
|
-
const int8ArrayTag = '[object Int8Array]';
|
|
45
|
-
const int16ArrayTag = '[object Int16Array]';
|
|
46
|
-
const int32ArrayTag = '[object Int32Array]';
|
|
47
|
-
const bigInt64ArrayTag = '[object BigInt64Array]';
|
|
48
|
-
const float32ArrayTag = '[object Float32Array]';
|
|
49
|
-
const float64ArrayTag = '[object Float64Array]';
|
|
50
|
-
|
|
51
|
-
function isPlainObject(value) {
|
|
52
|
-
if (!value || typeof value !== 'object') {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
const proto = Object.getPrototypeOf(value);
|
|
56
|
-
const hasObjectPrototype = proto === null ||
|
|
57
|
-
proto === Object.prototype ||
|
|
58
|
-
Object.getPrototypeOf(proto) === null;
|
|
59
|
-
if (!hasObjectPrototype) {
|
|
10
|
+
function isBlob(x) {
|
|
11
|
+
if (typeof Blob === 'undefined') {
|
|
60
12
|
return false;
|
|
61
13
|
}
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function isLength(value) {
|
|
66
|
-
return Number.isSafeInteger(value) && value >= 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function eq(value, other) {
|
|
70
|
-
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function isNil(x) {
|
|
74
|
-
return x == null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function isNull(x) {
|
|
78
|
-
return x === null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function isUndefined(x) {
|
|
82
|
-
return x === undefined;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function isSymbol(value) {
|
|
86
|
-
return typeof value === 'symbol';
|
|
14
|
+
return x instanceof Blob;
|
|
87
15
|
}
|
|
88
16
|
|
|
89
|
-
function
|
|
90
|
-
return typeof
|
|
17
|
+
function isBrowser() {
|
|
18
|
+
return typeof window !== 'undefined' && window?.document != null;
|
|
91
19
|
}
|
|
92
20
|
|
|
93
21
|
function isBuffer(x) {
|
|
94
22
|
return typeof Buffer !== 'undefined' && Buffer.isBuffer(x);
|
|
95
23
|
}
|
|
96
24
|
|
|
97
|
-
function isArrayBuffer(value) {
|
|
98
|
-
return value instanceof ArrayBuffer;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
25
|
function isDate(value) {
|
|
102
26
|
return value instanceof Date;
|
|
103
27
|
}
|
|
104
28
|
|
|
29
|
+
function eq(value, other) {
|
|
30
|
+
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
|
31
|
+
}
|
|
32
|
+
|
|
105
33
|
function isEqualWith(a, b, areValuesEqual) {
|
|
106
34
|
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
|
107
35
|
}
|
|
@@ -136,33 +64,33 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
136
64
|
if (Object.is(a, b)) {
|
|
137
65
|
return true;
|
|
138
66
|
}
|
|
139
|
-
let aTag = getTag(a);
|
|
140
|
-
let bTag = getTag(b);
|
|
141
|
-
if (aTag === argumentsTag) {
|
|
142
|
-
aTag = objectTag;
|
|
67
|
+
let aTag = isPlainObject.getTag(a);
|
|
68
|
+
let bTag = isPlainObject.getTag(b);
|
|
69
|
+
if (aTag === isPlainObject.argumentsTag) {
|
|
70
|
+
aTag = isPlainObject.objectTag;
|
|
143
71
|
}
|
|
144
|
-
if (bTag === argumentsTag) {
|
|
145
|
-
bTag = objectTag;
|
|
72
|
+
if (bTag === isPlainObject.argumentsTag) {
|
|
73
|
+
bTag = isPlainObject.objectTag;
|
|
146
74
|
}
|
|
147
75
|
if (aTag !== bTag) {
|
|
148
76
|
return false;
|
|
149
77
|
}
|
|
150
78
|
switch (aTag) {
|
|
151
|
-
case stringTag:
|
|
79
|
+
case isPlainObject.stringTag:
|
|
152
80
|
return a.toString() === b.toString();
|
|
153
|
-
case numberTag: {
|
|
81
|
+
case isPlainObject.numberTag: {
|
|
154
82
|
const x = a.valueOf();
|
|
155
83
|
const y = b.valueOf();
|
|
156
84
|
return eq(x, y);
|
|
157
85
|
}
|
|
158
|
-
case booleanTag:
|
|
159
|
-
case dateTag:
|
|
160
|
-
case symbolTag:
|
|
86
|
+
case isPlainObject.booleanTag:
|
|
87
|
+
case isPlainObject.dateTag:
|
|
88
|
+
case isPlainObject.symbolTag:
|
|
161
89
|
return Object.is(a.valueOf(), b.valueOf());
|
|
162
|
-
case regexpTag: {
|
|
90
|
+
case isPlainObject.regexpTag: {
|
|
163
91
|
return a.source === b.source && a.flags === b.flags;
|
|
164
92
|
}
|
|
165
|
-
case functionTag: {
|
|
93
|
+
case isPlainObject.functionTag: {
|
|
166
94
|
return a === b;
|
|
167
95
|
}
|
|
168
96
|
}
|
|
@@ -176,7 +104,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
176
104
|
stack.set(b, a);
|
|
177
105
|
try {
|
|
178
106
|
switch (aTag) {
|
|
179
|
-
case mapTag: {
|
|
107
|
+
case isPlainObject.mapTag: {
|
|
180
108
|
if (a.size !== b.size) {
|
|
181
109
|
return false;
|
|
182
110
|
}
|
|
@@ -187,7 +115,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
187
115
|
}
|
|
188
116
|
return true;
|
|
189
117
|
}
|
|
190
|
-
case setTag: {
|
|
118
|
+
case isPlainObject.setTag: {
|
|
191
119
|
if (a.size !== b.size) {
|
|
192
120
|
return false;
|
|
193
121
|
}
|
|
@@ -205,18 +133,18 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
205
133
|
}
|
|
206
134
|
return true;
|
|
207
135
|
}
|
|
208
|
-
case arrayTag:
|
|
209
|
-
case uint8ArrayTag:
|
|
210
|
-
case uint8ClampedArrayTag:
|
|
211
|
-
case uint16ArrayTag:
|
|
212
|
-
case uint32ArrayTag:
|
|
213
|
-
case bigUint64ArrayTag:
|
|
214
|
-
case int8ArrayTag:
|
|
215
|
-
case int16ArrayTag:
|
|
216
|
-
case int32ArrayTag:
|
|
217
|
-
case bigInt64ArrayTag:
|
|
218
|
-
case float32ArrayTag:
|
|
219
|
-
case float64ArrayTag: {
|
|
136
|
+
case isPlainObject.arrayTag:
|
|
137
|
+
case isPlainObject.uint8ArrayTag:
|
|
138
|
+
case isPlainObject.uint8ClampedArrayTag:
|
|
139
|
+
case isPlainObject.uint16ArrayTag:
|
|
140
|
+
case isPlainObject.uint32ArrayTag:
|
|
141
|
+
case isPlainObject.bigUint64ArrayTag:
|
|
142
|
+
case isPlainObject.int8ArrayTag:
|
|
143
|
+
case isPlainObject.int16ArrayTag:
|
|
144
|
+
case isPlainObject.int32ArrayTag:
|
|
145
|
+
case isPlainObject.bigInt64ArrayTag:
|
|
146
|
+
case isPlainObject.float32ArrayTag:
|
|
147
|
+
case isPlainObject.float64ArrayTag: {
|
|
220
148
|
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
|
221
149
|
return false;
|
|
222
150
|
}
|
|
@@ -230,29 +158,29 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
230
158
|
}
|
|
231
159
|
return true;
|
|
232
160
|
}
|
|
233
|
-
case arrayBufferTag: {
|
|
161
|
+
case isPlainObject.arrayBufferTag: {
|
|
234
162
|
if (a.byteLength !== b.byteLength) {
|
|
235
163
|
return false;
|
|
236
164
|
}
|
|
237
165
|
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
238
166
|
}
|
|
239
|
-
case dataViewTag: {
|
|
167
|
+
case isPlainObject.dataViewTag: {
|
|
240
168
|
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
|
241
169
|
return false;
|
|
242
170
|
}
|
|
243
171
|
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
244
172
|
}
|
|
245
|
-
case errorTag: {
|
|
173
|
+
case isPlainObject.errorTag: {
|
|
246
174
|
return a.name === b.name && a.message === b.message;
|
|
247
175
|
}
|
|
248
|
-
case objectTag: {
|
|
176
|
+
case isPlainObject.objectTag: {
|
|
249
177
|
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
|
250
|
-
(isPlainObject(a) && isPlainObject(b));
|
|
178
|
+
(isPlainObject.isPlainObject(a) && isPlainObject.isPlainObject(b));
|
|
251
179
|
if (!areEqualInstances) {
|
|
252
180
|
return false;
|
|
253
181
|
}
|
|
254
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
|
255
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
|
182
|
+
const aKeys = [...Object.keys(a), ...isPlainObject.getSymbols(a)];
|
|
183
|
+
const bKeys = [...Object.keys(b), ...isPlainObject.getSymbols(b)];
|
|
256
184
|
if (aKeys.length !== bKeys.length) {
|
|
257
185
|
return false;
|
|
258
186
|
}
|
|
@@ -280,37 +208,6 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
280
208
|
}
|
|
281
209
|
}
|
|
282
210
|
|
|
283
|
-
function isMap(value) {
|
|
284
|
-
return value instanceof Map;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function isRegExp(value) {
|
|
288
|
-
return value instanceof RegExp;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function isSet(value) {
|
|
292
|
-
return value instanceof Set;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function isWeakMap(value) {
|
|
296
|
-
return value instanceof WeakMap;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function isWeakSet(value) {
|
|
300
|
-
return value instanceof WeakSet;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function isBlob(x) {
|
|
304
|
-
if (typeof Blob === 'undefined') {
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
return x instanceof Blob;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function isBrowser() {
|
|
311
|
-
return typeof window !== 'undefined' && window?.document != null;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
211
|
function isEqual(a, b) {
|
|
315
212
|
return isEqualWith(a, b, noop.noop);
|
|
316
213
|
}
|
|
@@ -322,6 +219,10 @@ function isFile(x) {
|
|
|
322
219
|
return isBlob(x) && x instanceof File;
|
|
323
220
|
}
|
|
324
221
|
|
|
222
|
+
function isFunction(value) {
|
|
223
|
+
return typeof value === 'function';
|
|
224
|
+
}
|
|
225
|
+
|
|
325
226
|
function isJSON(value) {
|
|
326
227
|
if (typeof value !== 'string') {
|
|
327
228
|
return false;
|
|
@@ -357,7 +258,7 @@ function isJSONArray(value) {
|
|
|
357
258
|
return value.every(item => isJSONValue(item));
|
|
358
259
|
}
|
|
359
260
|
function isJSONObject(obj) {
|
|
360
|
-
if (!isPlainObject(obj)) {
|
|
261
|
+
if (!isPlainObject.isPlainObject(obj)) {
|
|
361
262
|
return false;
|
|
362
263
|
}
|
|
363
264
|
const keys = Reflect.ownKeys(obj);
|
|
@@ -374,6 +275,18 @@ function isJSONObject(obj) {
|
|
|
374
275
|
return true;
|
|
375
276
|
}
|
|
376
277
|
|
|
278
|
+
function isLength(value) {
|
|
279
|
+
return Number.isSafeInteger(value) && value >= 0;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function isMap(value) {
|
|
283
|
+
return value instanceof Map;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function isNil(x) {
|
|
287
|
+
return x == null;
|
|
288
|
+
}
|
|
289
|
+
|
|
377
290
|
function isNode() {
|
|
378
291
|
return typeof process !== 'undefined' && process?.versions?.node != null;
|
|
379
292
|
}
|
|
@@ -382,24 +295,39 @@ function isNotNil(x) {
|
|
|
382
295
|
return x != null;
|
|
383
296
|
}
|
|
384
297
|
|
|
298
|
+
function isNull(x) {
|
|
299
|
+
return x === null;
|
|
300
|
+
}
|
|
301
|
+
|
|
385
302
|
function isPromise(value) {
|
|
386
303
|
return value instanceof Promise;
|
|
387
304
|
}
|
|
388
305
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
306
|
+
function isRegExp(value) {
|
|
307
|
+
return value instanceof RegExp;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function isSet(value) {
|
|
311
|
+
return value instanceof Set;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function isSymbol(value) {
|
|
315
|
+
return typeof value === 'symbol';
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function isUndefined(x) {
|
|
319
|
+
return x === undefined;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function isWeakMap(value) {
|
|
323
|
+
return value instanceof WeakMap;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function isWeakSet(value) {
|
|
327
|
+
return value instanceof WeakSet;
|
|
328
|
+
}
|
|
329
|
+
|
|
395
330
|
exports.eq = eq;
|
|
396
|
-
exports.float32ArrayTag = float32ArrayTag;
|
|
397
|
-
exports.float64ArrayTag = float64ArrayTag;
|
|
398
|
-
exports.getSymbols = getSymbols;
|
|
399
|
-
exports.getTag = getTag;
|
|
400
|
-
exports.int16ArrayTag = int16ArrayTag;
|
|
401
|
-
exports.int32ArrayTag = int32ArrayTag;
|
|
402
|
-
exports.int8ArrayTag = int8ArrayTag;
|
|
403
331
|
exports.isArrayBuffer = isArrayBuffer;
|
|
404
332
|
exports.isBlob = isBlob;
|
|
405
333
|
exports.isBrowser = isBrowser;
|
|
@@ -419,24 +347,10 @@ exports.isNil = isNil;
|
|
|
419
347
|
exports.isNode = isNode;
|
|
420
348
|
exports.isNotNil = isNotNil;
|
|
421
349
|
exports.isNull = isNull;
|
|
422
|
-
exports.isPlainObject = isPlainObject;
|
|
423
|
-
exports.isPrimitive = isPrimitive;
|
|
424
350
|
exports.isPromise = isPromise;
|
|
425
351
|
exports.isRegExp = isRegExp;
|
|
426
352
|
exports.isSet = isSet;
|
|
427
353
|
exports.isSymbol = isSymbol;
|
|
428
|
-
exports.isTypedArray = isTypedArray;
|
|
429
354
|
exports.isUndefined = isUndefined;
|
|
430
355
|
exports.isWeakMap = isWeakMap;
|
|
431
356
|
exports.isWeakSet = isWeakSet;
|
|
432
|
-
exports.mapTag = mapTag;
|
|
433
|
-
exports.numberTag = numberTag;
|
|
434
|
-
exports.objectTag = objectTag;
|
|
435
|
-
exports.regexpTag = regexpTag;
|
|
436
|
-
exports.setTag = setTag;
|
|
437
|
-
exports.stringTag = stringTag;
|
|
438
|
-
exports.symbolTag = symbolTag;
|
|
439
|
-
exports.uint16ArrayTag = uint16ArrayTag;
|
|
440
|
-
exports.uint32ArrayTag = uint32ArrayTag;
|
|
441
|
-
exports.uint8ArrayTag = uint8ArrayTag;
|
|
442
|
-
exports.uint8ClampedArrayTag = uint8ClampedArrayTag;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function capitalize(str) {
|
|
4
|
+
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
8
|
+
function words(str) {
|
|
9
|
+
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function camelCase(str) {
|
|
13
|
+
const words$1 = words(str);
|
|
14
|
+
if (words$1.length === 0) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
const [first, ...rest] = words$1;
|
|
18
|
+
return `${first.toLowerCase()}${rest.map(word => capitalize(word)).join('')}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function snakeCase(str) {
|
|
22
|
+
const words$1 = words(str);
|
|
23
|
+
return words$1.map(word => word.toLowerCase()).join('_');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.CASE_SPLIT_PATTERN = CASE_SPLIT_PATTERN;
|
|
27
|
+
exports.camelCase = camelCase;
|
|
28
|
+
exports.capitalize = capitalize;
|
|
29
|
+
exports.snakeCase = snakeCase;
|
|
30
|
+
exports.words = words;
|