es-toolkit 1.13.1-dev.360 → 1.13.1-dev.361
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/_chunk/{union-CdQeDK.js → isNil-IuJ4cv.js} +5 -0
- package/dist/array/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +16 -4
- package/dist/array/index.mjs +1 -0
- package/dist/array/size.d.mts +39 -0
- package/dist/array/size.d.ts +39 -0
- package/dist/array/size.mjs +14 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +9 -8
- package/dist/compat/index.mjs +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -8
- package/dist/index.mjs +1 -0
- package/dist/object/index.js +4 -4
- package/dist/predicate/index.js +7 -11
- package/package.json +1 -1
- package/dist/_chunk/{isTypedArray-BBEkFl.js → isPrimitive-BBs6Fb.js} +4 -4
package/dist/compat/index.d.mts
CHANGED
|
@@ -45,6 +45,7 @@ export { tail } from '../array/tail.mjs';
|
|
|
45
45
|
export { toFilled } from '../array/toFilled.mjs';
|
|
46
46
|
export { last } from '../array/last.mjs';
|
|
47
47
|
export { initial } from '../array/initial.mjs';
|
|
48
|
+
export { size } from '../array/size.mjs';
|
|
48
49
|
export { AbortError } from '../error/AbortError.mjs';
|
|
49
50
|
export { TimeoutError } from '../error/TimeoutError.mjs';
|
|
50
51
|
export { before } from '../function/before.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export { tail } from '../array/tail.js';
|
|
|
45
45
|
export { toFilled } from '../array/toFilled.js';
|
|
46
46
|
export { last } from '../array/last.js';
|
|
47
47
|
export { initial } from '../array/initial.js';
|
|
48
|
+
export { size } from '../array/size.js';
|
|
48
49
|
export { AbortError } from '../error/AbortError.js';
|
|
49
50
|
export { TimeoutError } from '../error/TimeoutError.js';
|
|
50
51
|
export { before } from '../function/before.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const array_index = require('../array/index.js');
|
|
6
|
-
const
|
|
6
|
+
const isNil = require('../_chunk/isNil-IuJ4cv.js');
|
|
7
7
|
const promise_index = require('../_chunk/index-CwRt_M.js');
|
|
8
8
|
const function_index = require('../function/index.js');
|
|
9
9
|
const math_index = require('../math/index.js');
|
|
10
10
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
11
11
|
const object_index = require('../object/index.js');
|
|
12
12
|
const predicate_index = require('../predicate/index.js');
|
|
13
|
-
const
|
|
13
|
+
const isPrimitive = require('../_chunk/isPrimitive-BBs6Fb.js');
|
|
14
14
|
const string_index = require('../string/index.js');
|
|
15
15
|
|
|
16
16
|
function chunk(arr, size = 1) {
|
|
@@ -258,7 +258,7 @@ function isArray(value) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
function isTypedArray(x) {
|
|
261
|
-
return
|
|
261
|
+
return isPrimitive.isTypedArray(x);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
function isArrayMatch(target, source) {
|
|
@@ -335,7 +335,7 @@ function isMatch(target, source) {
|
|
|
335
335
|
}
|
|
336
336
|
for (let i = 0; i < keys.length; i++) {
|
|
337
337
|
const key = keys[i];
|
|
338
|
-
if (!
|
|
338
|
+
if (!isPrimitive.isPrimitive(target) && !(key in target)) {
|
|
339
339
|
return false;
|
|
340
340
|
}
|
|
341
341
|
if (source[key] === undefined && target[key] !== undefined) {
|
|
@@ -425,6 +425,7 @@ exports.partition = array_index.partition;
|
|
|
425
425
|
exports.sample = array_index.sample;
|
|
426
426
|
exports.sampleSize = array_index.sampleSize;
|
|
427
427
|
exports.shuffle = array_index.shuffle;
|
|
428
|
+
exports.size = array_index.size;
|
|
428
429
|
exports.tail = array_index.tail;
|
|
429
430
|
exports.take = array_index.take;
|
|
430
431
|
exports.takeRight = array_index.takeRight;
|
|
@@ -444,8 +445,9 @@ exports.xorWith = array_index.xorWith;
|
|
|
444
445
|
exports.zip = array_index.zip;
|
|
445
446
|
exports.zipObject = array_index.zipObject;
|
|
446
447
|
exports.zipWith = array_index.zipWith;
|
|
447
|
-
exports.
|
|
448
|
-
exports.
|
|
448
|
+
exports.isNil = isNil.isNil;
|
|
449
|
+
exports.union = isNil.union;
|
|
450
|
+
exports.uniq = isNil.uniq;
|
|
449
451
|
exports.AbortError = promise_index.AbortError;
|
|
450
452
|
exports.TimeoutError = promise_index.TimeoutError;
|
|
451
453
|
exports.delay = promise_index.delay;
|
|
@@ -481,12 +483,11 @@ exports.isArrayLike = predicate_index.isArrayLike;
|
|
|
481
483
|
exports.isEqual = predicate_index.isEqual;
|
|
482
484
|
exports.isFunction = predicate_index.isFunction;
|
|
483
485
|
exports.isLength = predicate_index.isLength;
|
|
484
|
-
exports.isNil = predicate_index.isNil;
|
|
485
486
|
exports.isNotNil = predicate_index.isNotNil;
|
|
486
487
|
exports.isNull = predicate_index.isNull;
|
|
487
488
|
exports.isObjectLike = predicate_index.isObjectLike;
|
|
488
489
|
exports.isUndefined = predicate_index.isUndefined;
|
|
489
|
-
exports.isPrimitive =
|
|
490
|
+
exports.isPrimitive = isPrimitive.isPrimitive;
|
|
490
491
|
exports.camelCase = string_index.camelCase;
|
|
491
492
|
exports.capitalize = string_index.capitalize;
|
|
492
493
|
exports.kebabCase = string_index.kebabCase;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -45,6 +45,7 @@ export { tail } from '../array/tail.mjs';
|
|
|
45
45
|
export { toFilled } from '../array/toFilled.mjs';
|
|
46
46
|
export { last } from '../array/last.mjs';
|
|
47
47
|
export { initial } from '../array/initial.mjs';
|
|
48
|
+
export { size } from '../array/size.mjs';
|
|
48
49
|
export { AbortError } from '../error/AbortError.mjs';
|
|
49
50
|
export { TimeoutError } from '../error/TimeoutError.mjs';
|
|
50
51
|
export { before } from '../function/before.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -49,6 +49,7 @@ export { tail } from './array/tail.mjs';
|
|
|
49
49
|
export { toFilled } from './array/toFilled.mjs';
|
|
50
50
|
export { last } from './array/last.mjs';
|
|
51
51
|
export { initial } from './array/initial.mjs';
|
|
52
|
+
export { size } from './array/size.mjs';
|
|
52
53
|
export { AbortError } from './error/AbortError.mjs';
|
|
53
54
|
export { TimeoutError } from './error/TimeoutError.mjs';
|
|
54
55
|
export { before } from './function/before.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export { tail } from './array/tail.js';
|
|
|
49
49
|
export { toFilled } from './array/toFilled.js';
|
|
50
50
|
export { last } from './array/last.js';
|
|
51
51
|
export { initial } from './array/initial.js';
|
|
52
|
+
export { size } from './array/size.js';
|
|
52
53
|
export { AbortError } from './error/AbortError.js';
|
|
53
54
|
export { TimeoutError } from './error/TimeoutError.js';
|
|
54
55
|
export { before } from './function/before.js';
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const array_index = require('./array/index.js');
|
|
6
|
-
const
|
|
6
|
+
const isNil = require('./_chunk/isNil-IuJ4cv.js');
|
|
7
7
|
const promise_index = require('./_chunk/index-CwRt_M.js');
|
|
8
8
|
const function_index = require('./function/index.js');
|
|
9
9
|
const math_index = require('./math/index.js');
|
|
10
10
|
const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
11
11
|
const object_index = require('./object/index.js');
|
|
12
12
|
const predicate_index = require('./predicate/index.js');
|
|
13
|
-
const
|
|
13
|
+
const isPrimitive = require('./_chunk/isPrimitive-BBs6Fb.js');
|
|
14
14
|
const string_index = require('./string/index.js');
|
|
15
15
|
|
|
16
16
|
|
|
@@ -45,6 +45,7 @@ exports.partition = array_index.partition;
|
|
|
45
45
|
exports.sample = array_index.sample;
|
|
46
46
|
exports.sampleSize = array_index.sampleSize;
|
|
47
47
|
exports.shuffle = array_index.shuffle;
|
|
48
|
+
exports.size = array_index.size;
|
|
48
49
|
exports.tail = array_index.tail;
|
|
49
50
|
exports.take = array_index.take;
|
|
50
51
|
exports.takeRight = array_index.takeRight;
|
|
@@ -64,8 +65,9 @@ exports.xorWith = array_index.xorWith;
|
|
|
64
65
|
exports.zip = array_index.zip;
|
|
65
66
|
exports.zipObject = array_index.zipObject;
|
|
66
67
|
exports.zipWith = array_index.zipWith;
|
|
67
|
-
exports.
|
|
68
|
-
exports.
|
|
68
|
+
exports.isNil = isNil.isNil;
|
|
69
|
+
exports.union = isNil.union;
|
|
70
|
+
exports.uniq = isNil.uniq;
|
|
69
71
|
exports.AbortError = promise_index.AbortError;
|
|
70
72
|
exports.TimeoutError = promise_index.TimeoutError;
|
|
71
73
|
exports.delay = promise_index.delay;
|
|
@@ -102,14 +104,13 @@ exports.isArrayLike = predicate_index.isArrayLike;
|
|
|
102
104
|
exports.isEqual = predicate_index.isEqual;
|
|
103
105
|
exports.isFunction = predicate_index.isFunction;
|
|
104
106
|
exports.isLength = predicate_index.isLength;
|
|
105
|
-
exports.isNil = predicate_index.isNil;
|
|
106
107
|
exports.isNotNil = predicate_index.isNotNil;
|
|
107
108
|
exports.isNull = predicate_index.isNull;
|
|
108
109
|
exports.isObjectLike = predicate_index.isObjectLike;
|
|
109
110
|
exports.isUndefined = predicate_index.isUndefined;
|
|
110
|
-
exports.isPlainObject =
|
|
111
|
-
exports.isPrimitive =
|
|
112
|
-
exports.isTypedArray =
|
|
111
|
+
exports.isPlainObject = isPrimitive.isPlainObject;
|
|
112
|
+
exports.isPrimitive = isPrimitive.isPrimitive;
|
|
113
|
+
exports.isTypedArray = isPrimitive.isTypedArray;
|
|
113
114
|
exports.camelCase = string_index.camelCase;
|
|
114
115
|
exports.capitalize = string_index.capitalize;
|
|
115
116
|
exports.kebabCase = string_index.kebabCase;
|
package/dist/index.mjs
CHANGED
|
@@ -49,6 +49,7 @@ export { tail } from './array/tail.mjs';
|
|
|
49
49
|
export { toFilled } from './array/toFilled.mjs';
|
|
50
50
|
export { last } from './array/last.mjs';
|
|
51
51
|
export { initial } from './array/initial.mjs';
|
|
52
|
+
export { size } from './array/size.mjs';
|
|
52
53
|
export { AbortError } from './error/AbortError.mjs';
|
|
53
54
|
export { TimeoutError } from './error/TimeoutError.mjs';
|
|
54
55
|
export { before } from './function/before.mjs';
|
package/dist/object/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const isPrimitive$1 = require('../_chunk/isPrimitive-BBs6Fb.js');
|
|
6
6
|
|
|
7
7
|
function omit(obj, keys) {
|
|
8
8
|
const result = { ...obj };
|
|
@@ -101,7 +101,7 @@ function flattenObjectImpl(object, prefix = '') {
|
|
|
101
101
|
const key = keys[i];
|
|
102
102
|
const value = object[key];
|
|
103
103
|
const prefixedKey = prefix ? `${prefix}.${key}` : key;
|
|
104
|
-
if (
|
|
104
|
+
if (isPrimitive$1.isPlainObject(value) && Object.keys(value).length > 0) {
|
|
105
105
|
Object.assign(result, flattenObjectImpl(value, prefixedKey));
|
|
106
106
|
continue;
|
|
107
107
|
}
|
|
@@ -142,7 +142,7 @@ function cloneDeep(obj) {
|
|
|
142
142
|
return cloneDeepImpl(obj);
|
|
143
143
|
}
|
|
144
144
|
function cloneDeepImpl(obj, stack = new Map()) {
|
|
145
|
-
if (
|
|
145
|
+
if (isPrimitive$1.isPrimitive(obj)) {
|
|
146
146
|
return obj;
|
|
147
147
|
}
|
|
148
148
|
if (stack.has(obj)) {
|
|
@@ -189,7 +189,7 @@ function cloneDeepImpl(obj, stack = new Map()) {
|
|
|
189
189
|
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(obj)) {
|
|
190
190
|
return obj.subarray();
|
|
191
191
|
}
|
|
192
|
-
if (
|
|
192
|
+
if (isPrimitive$1.isTypedArray(obj)) {
|
|
193
193
|
const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);
|
|
194
194
|
stack.set(obj, result);
|
|
195
195
|
for (let i = 0; i < obj.length; i++) {
|
package/dist/predicate/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const isNil = require('../_chunk/isNil-IuJ4cv.js');
|
|
6
|
+
const isPrimitive = require('../_chunk/isPrimitive-BBs6Fb.js');
|
|
7
7
|
|
|
8
8
|
function isEqual(a, b) {
|
|
9
9
|
if (Object.is(a, b)) {
|
|
@@ -23,7 +23,7 @@ function isEqual(a, b) {
|
|
|
23
23
|
if (aKeys.length !== bKeys.length) {
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
26
|
+
if (isNil.union(aKeys, bKeys).length !== aKeys.length) {
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
for (let i = 0; i < aKeys.length; i++) {
|
|
@@ -37,10 +37,6 @@ function isEqual(a, b) {
|
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function isNil(x) {
|
|
41
|
-
return x == null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
40
|
function isNotNil(x) {
|
|
45
41
|
return x !== null && x !== undefined;
|
|
46
42
|
}
|
|
@@ -81,15 +77,15 @@ function isArguments(value) {
|
|
|
81
77
|
return value !== null && typeof value === 'object' && getTag(value) === '[object Arguments]';
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
exports.
|
|
85
|
-
exports.
|
|
86
|
-
exports.
|
|
80
|
+
exports.isNil = isNil.isNil;
|
|
81
|
+
exports.isPlainObject = isPrimitive.isPlainObject;
|
|
82
|
+
exports.isPrimitive = isPrimitive.isPrimitive;
|
|
83
|
+
exports.isTypedArray = isPrimitive.isTypedArray;
|
|
87
84
|
exports.isArguments = isArguments;
|
|
88
85
|
exports.isArrayLike = isArrayLike;
|
|
89
86
|
exports.isEqual = isEqual;
|
|
90
87
|
exports.isFunction = isFunction;
|
|
91
88
|
exports.isLength = isLength;
|
|
92
|
-
exports.isNil = isNil;
|
|
93
89
|
exports.isNotNil = isNotNil;
|
|
94
90
|
exports.isNull = isNull;
|
|
95
91
|
exports.isObjectLike = isObjectLike;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.13.1-dev.
|
|
4
|
+
"version": "1.13.1-dev.361+fcc166a8",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
|
@@ -20,10 +20,6 @@ function isPlainObject(object) {
|
|
|
20
20
|
return Object.getPrototypeOf(object) === proto;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function isPrimitive(value) {
|
|
24
|
-
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
function isTypedArray(x) {
|
|
28
24
|
return (x instanceof Uint8Array ||
|
|
29
25
|
x instanceof Uint8ClampedArray ||
|
|
@@ -38,6 +34,10 @@ function isTypedArray(x) {
|
|
|
38
34
|
x instanceof Float64Array);
|
|
39
35
|
}
|
|
40
36
|
|
|
37
|
+
function isPrimitive(value) {
|
|
38
|
+
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
41
|
exports.isPlainObject = isPlainObject;
|
|
42
42
|
exports.isPrimitive = isPrimitive;
|
|
43
43
|
exports.isTypedArray = isTypedArray;
|