es-toolkit 1.13.1-dev.389 → 1.13.1-dev.390

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.
@@ -1,4 +1,4 @@
1
- import { isNil } from '../predicate/isNil.mjs';
1
+ import { isNil } from '../../predicate/isNil.mjs';
2
2
 
3
3
  function size(target) {
4
4
  if (isNil(target)) {
@@ -45,7 +45,6 @@ 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';
49
48
  export { AbortError } from '../error/AbortError.mjs';
50
49
  export { TimeoutError } from '../error/TimeoutError.mjs';
51
50
  export { before } from '../function/before.mjs';
@@ -102,6 +101,7 @@ export { fill } from './array/fill.mjs';
102
101
  export { flatten } from './array/flatten.mjs';
103
102
  export { flattenDeep } from './array/flattenDeep.mjs';
104
103
  export { flattenDepth } from './array/flattenDepth.mjs';
104
+ export { size } from './array/size.mjs';
105
105
  export { zipObjectDeep } from './array/zipObjectDeep.mjs';
106
106
  export { ary } from './function/ary.mjs';
107
107
  export { bind } from './function/bind.mjs';
@@ -45,7 +45,6 @@ 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';
49
48
  export { AbortError } from '../error/AbortError.js';
50
49
  export { TimeoutError } from '../error/TimeoutError.js';
51
50
  export { before } from '../function/before.js';
@@ -102,6 +101,7 @@ export { fill } from './array/fill.js';
102
101
  export { flatten } from './array/flatten.js';
103
102
  export { flattenDeep } from './array/flattenDeep.js';
104
103
  export { flattenDepth } from './array/flattenDepth.js';
104
+ export { size } from './array/size.js';
105
105
  export { zipObjectDeep } from './array/zipObjectDeep.js';
106
106
  export { ary } from './function/ary.js';
107
107
  export { bind } from './function/bind.js';
@@ -2,33 +2,32 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const size = require('../_chunk/size-gkSUOE.js');
5
+ const initial = require('../_chunk/initial-BTrQy1.js');
6
6
  const promise_index = require('../_chunk/index-CwRt_M.js');
7
7
  const function_index = require('../function/index.js');
8
8
  const math_index = require('../math/index.js');
9
9
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
10
10
  const object_index = require('../object/index.js');
11
- const isArguments = require('../_chunk/isArguments-B5Iphy.js');
12
- const isNil = require('../_chunk/isNil-CYi_Vh.js');
11
+ const isArguments = require('../_chunk/isArguments-UkjX2G.js');
13
12
  const isTypedArray$1 = require('../_chunk/isTypedArray-BBEkFl.js');
14
13
  const string_index = require('../string/index.js');
15
14
 
16
- function chunk(arr, size$1 = 1) {
17
- size$1 = Math.max(Math.floor(size$1), 0);
18
- if (size$1 === 0) {
15
+ function chunk(arr, size = 1) {
16
+ size = Math.max(Math.floor(size), 0);
17
+ if (size === 0) {
19
18
  return [];
20
19
  }
21
- return size.chunk(arr, size$1);
20
+ return initial.chunk(arr, size);
22
21
  }
23
22
 
24
23
  function concat(...values) {
25
- return size.flatten(values);
24
+ return initial.flatten(values);
26
25
  }
27
26
 
28
27
  function difference(arr, ...values) {
29
28
  const arr1 = arr;
30
- const arr2 = size.flatten(values);
31
- return size.difference(arr1, arr2);
29
+ const arr2 = initial.flatten(values);
30
+ return initial.difference(arr1, arr2);
32
31
  }
33
32
 
34
33
  function fill(array, value, start = 0, end = array.length) {
@@ -40,7 +39,7 @@ function fill(array, value, start = 0, end = array.length) {
40
39
  if (!end) {
41
40
  end = 0;
42
41
  }
43
- return size.fill(array, value, start, end);
42
+ return initial.fill(array, value, start, end);
44
43
  }
45
44
 
46
45
  function flatten(value, depth = 1) {
@@ -79,6 +78,16 @@ function flattenDepth(value, depth = 1) {
79
78
  return flatten(value, depth);
80
79
  }
81
80
 
81
+ function size(target) {
82
+ if (isArguments.isNil(target)) {
83
+ return 0;
84
+ }
85
+ if (target instanceof Map || target instanceof Set) {
86
+ return target.size;
87
+ }
88
+ return Object.keys(target).length;
89
+ }
90
+
82
91
  const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
83
92
  function isIndex(value) {
84
93
  switch (typeof value) {
@@ -155,7 +164,7 @@ function set(obj, path, value) {
155
164
 
156
165
  function zipObjectDeep(keys, values) {
157
166
  const result = {};
158
- const zipped = size.zip(keys, values);
167
+ const zipped = initial.zip(keys, values);
159
168
  for (let i = 0; i < zipped.length; i++) {
160
169
  const [key, value] = zipped[i];
161
170
  if (key != null) {
@@ -452,55 +461,54 @@ function min(items = []) {
452
461
  return minElement;
453
462
  }
454
463
 
455
- exports.compact = size.compact;
456
- exports.countBy = size.countBy;
457
- exports.differenceBy = size.differenceBy;
458
- exports.differenceWith = size.differenceWith;
459
- exports.drop = size.drop;
460
- exports.dropRight = size.dropRight;
461
- exports.dropRightWhile = size.dropRightWhile;
462
- exports.dropWhile = size.dropWhile;
463
- exports.first = size.head;
464
- exports.flatMap = size.flatMap;
465
- exports.forEachRight = size.forEachRight;
466
- exports.groupBy = size.groupBy;
467
- exports.head = size.head;
468
- exports.initial = size.initial;
469
- exports.intersection = size.intersection;
470
- exports.intersectionBy = size.intersectionBy;
471
- exports.intersectionWith = size.intersectionWith;
472
- exports.isSubset = size.isSubset;
473
- exports.keyBy = size.keyBy;
474
- exports.last = size.last;
475
- exports.maxBy = size.maxBy;
476
- exports.minBy = size.minBy;
477
- exports.orderBy = size.orderBy;
478
- exports.partition = size.partition;
479
- exports.sample = size.sample;
480
- exports.sampleSize = size.sampleSize;
481
- exports.shuffle = size.shuffle;
482
- exports.size = size.size;
483
- exports.tail = size.tail;
484
- exports.take = size.take;
485
- exports.takeRight = size.takeRight;
486
- exports.takeRightWhile = size.takeRightWhile;
487
- exports.takeWhile = size.takeWhile;
488
- exports.toFilled = size.toFilled;
489
- exports.union = size.union;
490
- exports.unionBy = size.unionBy;
491
- exports.unionWith = size.unionWith;
492
- exports.uniq = size.uniq;
493
- exports.uniqBy = size.uniqBy;
494
- exports.uniqWith = size.uniqWith;
495
- exports.unzip = size.unzip;
496
- exports.unzipWith = size.unzipWith;
497
- exports.without = size.without;
498
- exports.xor = size.xor;
499
- exports.xorBy = size.xorBy;
500
- exports.xorWith = size.xorWith;
501
- exports.zip = size.zip;
502
- exports.zipObject = size.zipObject;
503
- exports.zipWith = size.zipWith;
464
+ exports.compact = initial.compact;
465
+ exports.countBy = initial.countBy;
466
+ exports.differenceBy = initial.differenceBy;
467
+ exports.differenceWith = initial.differenceWith;
468
+ exports.drop = initial.drop;
469
+ exports.dropRight = initial.dropRight;
470
+ exports.dropRightWhile = initial.dropRightWhile;
471
+ exports.dropWhile = initial.dropWhile;
472
+ exports.first = initial.head;
473
+ exports.flatMap = initial.flatMap;
474
+ exports.forEachRight = initial.forEachRight;
475
+ exports.groupBy = initial.groupBy;
476
+ exports.head = initial.head;
477
+ exports.initial = initial.initial;
478
+ exports.intersection = initial.intersection;
479
+ exports.intersectionBy = initial.intersectionBy;
480
+ exports.intersectionWith = initial.intersectionWith;
481
+ exports.isSubset = initial.isSubset;
482
+ exports.keyBy = initial.keyBy;
483
+ exports.last = initial.last;
484
+ exports.maxBy = initial.maxBy;
485
+ exports.minBy = initial.minBy;
486
+ exports.orderBy = initial.orderBy;
487
+ exports.partition = initial.partition;
488
+ exports.sample = initial.sample;
489
+ exports.sampleSize = initial.sampleSize;
490
+ exports.shuffle = initial.shuffle;
491
+ exports.tail = initial.tail;
492
+ exports.take = initial.take;
493
+ exports.takeRight = initial.takeRight;
494
+ exports.takeRightWhile = initial.takeRightWhile;
495
+ exports.takeWhile = initial.takeWhile;
496
+ exports.toFilled = initial.toFilled;
497
+ exports.union = initial.union;
498
+ exports.unionBy = initial.unionBy;
499
+ exports.unionWith = initial.unionWith;
500
+ exports.uniq = initial.uniq;
501
+ exports.uniqBy = initial.uniqBy;
502
+ exports.uniqWith = initial.uniqWith;
503
+ exports.unzip = initial.unzip;
504
+ exports.unzipWith = initial.unzipWith;
505
+ exports.without = initial.without;
506
+ exports.xor = initial.xor;
507
+ exports.xorBy = initial.xorBy;
508
+ exports.xorWith = initial.xorWith;
509
+ exports.zip = initial.zip;
510
+ exports.zipObject = initial.zipObject;
511
+ exports.zipWith = initial.zipWith;
504
512
  exports.AbortError = promise_index.AbortError;
505
513
  exports.TimeoutError = promise_index.TimeoutError;
506
514
  exports.delay = promise_index.delay;
@@ -537,11 +545,11 @@ exports.isArrayLike = isArguments.isArrayLike;
537
545
  exports.isEqual = isArguments.isEqual;
538
546
  exports.isFunction = isArguments.isFunction;
539
547
  exports.isLength = isArguments.isLength;
548
+ exports.isNil = isArguments.isNil;
540
549
  exports.isNotNil = isArguments.isNotNil;
541
550
  exports.isNull = isArguments.isNull;
542
551
  exports.isObjectLike = isArguments.isObjectLike;
543
552
  exports.isUndefined = isArguments.isUndefined;
544
- exports.isNil = isNil.isNil;
545
553
  exports.isPrimitive = isTypedArray$1.isPrimitive;
546
554
  exports.camelCase = string_index.camelCase;
547
555
  exports.capitalize = string_index.capitalize;
@@ -572,5 +580,6 @@ exports.max = max;
572
580
  exports.min = min;
573
581
  exports.property = property;
574
582
  exports.set = set;
583
+ exports.size = size;
575
584
  exports.startsWith = startsWith;
576
585
  exports.zipObjectDeep = zipObjectDeep;
@@ -45,7 +45,6 @@ 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';
49
48
  export { AbortError } from '../error/AbortError.mjs';
50
49
  export { TimeoutError } from '../error/TimeoutError.mjs';
51
50
  export { before } from '../function/before.mjs';
@@ -102,6 +101,7 @@ export { fill } from './array/fill.mjs';
102
101
  export { flatten } from './array/flatten.mjs';
103
102
  export { flattenDeep } from './array/flattenDeep.mjs';
104
103
  export { flattenDepth } from './array/flattenDepth.mjs';
104
+ export { size } from './array/size.mjs';
105
105
  export { zipObjectDeep } from './array/zipObjectDeep.mjs';
106
106
  export { ary } from './function/ary.mjs';
107
107
  export { bind } from './function/bind.mjs';
package/dist/index.d.mts CHANGED
@@ -50,7 +50,6 @@ export { tail } from './array/tail.mjs';
50
50
  export { toFilled } from './array/toFilled.mjs';
51
51
  export { last } from './array/last.mjs';
52
52
  export { initial } from './array/initial.mjs';
53
- export { size } from './array/size.mjs';
54
53
  export { AbortError } from './error/AbortError.mjs';
55
54
  export { TimeoutError } from './error/TimeoutError.mjs';
56
55
  export { before } from './function/before.mjs';
package/dist/index.d.ts CHANGED
@@ -50,7 +50,6 @@ export { tail } from './array/tail.js';
50
50
  export { toFilled } from './array/toFilled.js';
51
51
  export { last } from './array/last.js';
52
52
  export { initial } from './array/initial.js';
53
- export { size } from './array/size.js';
54
53
  export { AbortError } from './error/AbortError.js';
55
54
  export { TimeoutError } from './error/TimeoutError.js';
56
55
  export { before } from './function/before.js';
package/dist/index.js CHANGED
@@ -2,73 +2,71 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const size = require('./_chunk/size-gkSUOE.js');
5
+ const initial = require('./_chunk/initial-BTrQy1.js');
6
6
  const array_index = require('./array/index.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
- const isArguments = require('./_chunk/isArguments-B5Iphy.js');
13
- const isNil = require('./_chunk/isNil-CYi_Vh.js');
12
+ const isArguments = require('./_chunk/isArguments-UkjX2G.js');
14
13
  const isTypedArray = require('./_chunk/isTypedArray-BBEkFl.js');
15
14
  const predicate_index = require('./predicate/index.js');
16
15
  const string_index = require('./string/index.js');
17
16
 
18
17
 
19
18
 
20
- exports.chunk = size.chunk;
21
- exports.compact = size.compact;
22
- exports.countBy = size.countBy;
23
- exports.difference = size.difference;
24
- exports.differenceBy = size.differenceBy;
25
- exports.differenceWith = size.differenceWith;
26
- exports.drop = size.drop;
27
- exports.dropRight = size.dropRight;
28
- exports.dropRightWhile = size.dropRightWhile;
29
- exports.dropWhile = size.dropWhile;
30
- exports.fill = size.fill;
31
- exports.flatMap = size.flatMap;
32
- exports.flatten = size.flatten;
33
- exports.forEachRight = size.forEachRight;
34
- exports.groupBy = size.groupBy;
35
- exports.head = size.head;
36
- exports.initial = size.initial;
37
- exports.intersection = size.intersection;
38
- exports.intersectionBy = size.intersectionBy;
39
- exports.intersectionWith = size.intersectionWith;
40
- exports.isSubset = size.isSubset;
41
- exports.keyBy = size.keyBy;
42
- exports.last = size.last;
43
- exports.maxBy = size.maxBy;
44
- exports.minBy = size.minBy;
45
- exports.orderBy = size.orderBy;
46
- exports.partition = size.partition;
47
- exports.sample = size.sample;
48
- exports.sampleSize = size.sampleSize;
49
- exports.shuffle = size.shuffle;
50
- exports.size = size.size;
51
- exports.tail = size.tail;
52
- exports.take = size.take;
53
- exports.takeRight = size.takeRight;
54
- exports.takeRightWhile = size.takeRightWhile;
55
- exports.takeWhile = size.takeWhile;
56
- exports.toFilled = size.toFilled;
57
- exports.union = size.union;
58
- exports.unionBy = size.unionBy;
59
- exports.unionWith = size.unionWith;
60
- exports.uniq = size.uniq;
61
- exports.uniqBy = size.uniqBy;
62
- exports.uniqWith = size.uniqWith;
63
- exports.unzip = size.unzip;
64
- exports.unzipWith = size.unzipWith;
65
- exports.without = size.without;
66
- exports.xor = size.xor;
67
- exports.xorBy = size.xorBy;
68
- exports.xorWith = size.xorWith;
69
- exports.zip = size.zip;
70
- exports.zipObject = size.zipObject;
71
- exports.zipWith = size.zipWith;
19
+ exports.chunk = initial.chunk;
20
+ exports.compact = initial.compact;
21
+ exports.countBy = initial.countBy;
22
+ exports.difference = initial.difference;
23
+ exports.differenceBy = initial.differenceBy;
24
+ exports.differenceWith = initial.differenceWith;
25
+ exports.drop = initial.drop;
26
+ exports.dropRight = initial.dropRight;
27
+ exports.dropRightWhile = initial.dropRightWhile;
28
+ exports.dropWhile = initial.dropWhile;
29
+ exports.fill = initial.fill;
30
+ exports.flatMap = initial.flatMap;
31
+ exports.flatten = initial.flatten;
32
+ exports.forEachRight = initial.forEachRight;
33
+ exports.groupBy = initial.groupBy;
34
+ exports.head = initial.head;
35
+ exports.initial = initial.initial;
36
+ exports.intersection = initial.intersection;
37
+ exports.intersectionBy = initial.intersectionBy;
38
+ exports.intersectionWith = initial.intersectionWith;
39
+ exports.isSubset = initial.isSubset;
40
+ exports.keyBy = initial.keyBy;
41
+ exports.last = initial.last;
42
+ exports.maxBy = initial.maxBy;
43
+ exports.minBy = initial.minBy;
44
+ exports.orderBy = initial.orderBy;
45
+ exports.partition = initial.partition;
46
+ exports.sample = initial.sample;
47
+ exports.sampleSize = initial.sampleSize;
48
+ exports.shuffle = initial.shuffle;
49
+ exports.tail = initial.tail;
50
+ exports.take = initial.take;
51
+ exports.takeRight = initial.takeRight;
52
+ exports.takeRightWhile = initial.takeRightWhile;
53
+ exports.takeWhile = initial.takeWhile;
54
+ exports.toFilled = initial.toFilled;
55
+ exports.union = initial.union;
56
+ exports.unionBy = initial.unionBy;
57
+ exports.unionWith = initial.unionWith;
58
+ exports.uniq = initial.uniq;
59
+ exports.uniqBy = initial.uniqBy;
60
+ exports.uniqWith = initial.uniqWith;
61
+ exports.unzip = initial.unzip;
62
+ exports.unzipWith = initial.unzipWith;
63
+ exports.without = initial.without;
64
+ exports.xor = initial.xor;
65
+ exports.xorBy = initial.xorBy;
66
+ exports.xorWith = initial.xorWith;
67
+ exports.zip = initial.zip;
68
+ exports.zipObject = initial.zipObject;
69
+ exports.zipWith = initial.zipWith;
72
70
  exports.flattenDeep = array_index.flattenDeep;
73
71
  exports.AbortError = promise_index.AbortError;
74
72
  exports.TimeoutError = promise_index.TimeoutError;
@@ -108,11 +106,11 @@ exports.isArrayLike = isArguments.isArrayLike;
108
106
  exports.isEqual = isArguments.isEqual;
109
107
  exports.isFunction = isArguments.isFunction;
110
108
  exports.isLength = isArguments.isLength;
109
+ exports.isNil = isArguments.isNil;
111
110
  exports.isNotNil = isArguments.isNotNil;
112
111
  exports.isNull = isArguments.isNull;
113
112
  exports.isObjectLike = isArguments.isObjectLike;
114
113
  exports.isUndefined = isArguments.isUndefined;
115
- exports.isNil = isNil.isNil;
116
114
  exports.isPlainObject = isTypedArray.isPlainObject;
117
115
  exports.isPrimitive = isTypedArray.isPrimitive;
118
116
  exports.isTypedArray = isTypedArray.isTypedArray;
package/dist/index.mjs CHANGED
@@ -50,7 +50,6 @@ export { tail } from './array/tail.mjs';
50
50
  export { toFilled } from './array/toFilled.mjs';
51
51
  export { last } from './array/last.mjs';
52
52
  export { initial } from './array/initial.mjs';
53
- export { size } from './array/size.mjs';
54
53
  export { AbortError } from './error/AbortError.mjs';
55
54
  export { TimeoutError } from './error/TimeoutError.mjs';
56
55
  export { before } from './function/before.mjs';
@@ -2,8 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const isArguments = require('../_chunk/isArguments-B5Iphy.js');
6
- const isNil = require('../_chunk/isNil-CYi_Vh.js');
5
+ const isArguments = require('../_chunk/isArguments-UkjX2G.js');
7
6
  const isTypedArray = require('../_chunk/isTypedArray-BBEkFl.js');
8
7
 
9
8
  function isBoolean(x) {
@@ -15,11 +14,11 @@ exports.isArrayLike = isArguments.isArrayLike;
15
14
  exports.isEqual = isArguments.isEqual;
16
15
  exports.isFunction = isArguments.isFunction;
17
16
  exports.isLength = isArguments.isLength;
17
+ exports.isNil = isArguments.isNil;
18
18
  exports.isNotNil = isArguments.isNotNil;
19
19
  exports.isNull = isArguments.isNull;
20
20
  exports.isObjectLike = isArguments.isObjectLike;
21
21
  exports.isUndefined = isArguments.isUndefined;
22
- exports.isNil = isNil.isNil;
23
22
  exports.isPlainObject = isTypedArray.isPlainObject;
24
23
  exports.isPrimitive = isTypedArray.isPrimitive;
25
24
  exports.isTypedArray = isTypedArray.isTypedArray;
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.389+9109e890",
4
+ "version": "1.13.1-dev.390+f5b43f13",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- function isNil(x) {
4
- return x == null;
5
- }
6
-
7
- exports.isNil = isNil;
File without changes
File without changes