es-toolkit 1.17.0-dev.538 → 1.17.0-dev.539

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/index.mjs CHANGED
@@ -16,24 +16,30 @@ export { flatten } from './array/flatten.mjs';
16
16
  export { flattenDeep } from './array/flattenDeep.mjs';
17
17
  export { forEachRight } from './array/forEachRight.mjs';
18
18
  export { groupBy } from './array/groupBy.mjs';
19
+ export { head } from './array/head.mjs';
20
+ export { initial } from './array/initial.mjs';
19
21
  export { intersection } from './array/intersection.mjs';
20
22
  export { intersectionBy } from './array/intersectionBy.mjs';
21
23
  export { intersectionWith } from './array/intersectionWith.mjs';
24
+ export { isSubset } from './array/isSubset.mjs';
22
25
  export { join } from './array/join.mjs';
23
26
  export { keyBy } from './array/keyBy.mjs';
27
+ export { last } from './array/last.mjs';
24
28
  export { maxBy } from './array/maxBy.mjs';
25
29
  export { minBy } from './array/minBy.mjs';
26
30
  export { orderBy } from './array/orderBy.mjs';
27
31
  export { partition } from './array/partition.mjs';
28
32
  export { pullAt } from './array/pullAt.mjs';
29
- export { sortBy } from './array/sortBy.mjs';
30
33
  export { sample } from './array/sample.mjs';
31
34
  export { sampleSize } from './array/sampleSize.mjs';
32
35
  export { shuffle } from './array/shuffle.mjs';
36
+ export { sortBy } from './array/sortBy.mjs';
37
+ export { tail } from './array/tail.mjs';
33
38
  export { take } from './array/take.mjs';
34
39
  export { takeRight } from './array/takeRight.mjs';
35
40
  export { takeRightWhile } from './array/takeRightWhile.mjs';
36
41
  export { takeWhile } from './array/takeWhile.mjs';
42
+ export { toFilled } from './array/toFilled.mjs';
37
43
  export { union } from './array/union.mjs';
38
44
  export { unionBy } from './array/unionBy.mjs';
39
45
  export { unionWith } from './array/unionWith.mjs';
@@ -42,19 +48,13 @@ export { uniqBy } from './array/uniqBy.mjs';
42
48
  export { uniqWith } from './array/uniqWith.mjs';
43
49
  export { unzip } from './array/unzip.mjs';
44
50
  export { unzipWith } from './array/unzipWith.mjs';
51
+ export { without } from './array/without.mjs';
45
52
  export { xor } from './array/xor.mjs';
46
53
  export { xorBy } from './array/xorBy.mjs';
47
54
  export { xorWith } from './array/xorWith.mjs';
48
55
  export { zip } from './array/zip.mjs';
49
56
  export { zipObject } from './array/zipObject.mjs';
50
57
  export { zipWith } from './array/zipWith.mjs';
51
- export { without } from './array/without.mjs';
52
- export { head } from './array/head.mjs';
53
- export { isSubset } from './array/isSubset.mjs';
54
- export { tail } from './array/tail.mjs';
55
- export { toFilled } from './array/toFilled.mjs';
56
- export { last } from './array/last.mjs';
57
- export { initial } from './array/initial.mjs';
58
58
  export { AbortError } from './error/AbortError.mjs';
59
59
  export { TimeoutError } from './error/TimeoutError.mjs';
60
60
  export { before } from './function/before.mjs';
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.17.0-dev.538+9dd29d59",
4
+ "version": "1.17.0-dev.539+3f49bc90",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {
@@ -152,6 +152,14 @@ function groupBy(arr, getKeyFromItem) {
152
152
  return result;
153
153
  }
154
154
 
155
+ function head(arr) {
156
+ return arr[0];
157
+ }
158
+
159
+ function initial(arr) {
160
+ return arr.slice(0, -1);
161
+ }
162
+
155
163
  function intersection(firstArr, secondArr) {
156
164
  const secondSet = new Set(secondArr);
157
165
  return firstArr.filter(item => {
@@ -172,6 +180,10 @@ function intersectionWith(firstArr, secondArr, areItemsEqual) {
172
180
  });
173
181
  }
174
182
 
183
+ function isSubset(superset, subset) {
184
+ return difference(subset, superset).length === 0;
185
+ }
186
+
175
187
  function join(array, separator = ',') {
176
188
  return array.join(separator);
177
189
  }
@@ -185,6 +197,10 @@ function keyBy(arr, getKeyFromItem) {
185
197
  return result;
186
198
  }
187
199
 
200
+ function last(arr) {
201
+ return arr[arr.length - 1];
202
+ }
203
+
188
204
  function maxBy(items, getValue) {
189
205
  let maxElement = items[0];
190
206
  let max = -Infinity;
@@ -265,6 +281,10 @@ function shuffle(arr) {
265
281
  return result;
266
282
  }
267
283
 
284
+ function tail(arr) {
285
+ return arr.slice(1);
286
+ }
287
+
268
288
  function take(arr, count) {
269
289
  return arr.slice(0, count);
270
290
  }
@@ -296,6 +316,17 @@ function takeWhile(arr, shouldContinueTaking) {
296
316
  return result;
297
317
  }
298
318
 
319
+ function toFilled(arr, value, start = 0, end = arr.length) {
320
+ const length = arr.length;
321
+ const finalStart = Math.max(start >= 0 ? start : length + start, 0);
322
+ const finalEnd = Math.min(end >= 0 ? end : length + end, length);
323
+ const newArr = arr.slice();
324
+ for (let i = finalStart; i < finalEnd; i++) {
325
+ newArr[i] = value;
326
+ }
327
+ return newArr;
328
+ }
329
+
299
330
  function uniq(arr) {
300
331
  return Array.from(new Set(arr));
301
332
  }
@@ -371,6 +402,11 @@ function unzipWith(target, iteratee) {
371
402
  return result;
372
403
  }
373
404
 
405
+ function without(array, ...values) {
406
+ const valuesSet = new Set(values);
407
+ return array.filter(item => !valuesSet.has(item));
408
+ }
409
+
374
410
  function xor(arr1, arr2) {
375
411
  return difference(union(arr1, arr2), intersection(arr1, arr2));
376
412
  }
@@ -420,42 +456,6 @@ function zipWith(arr1, ...rest) {
420
456
  return result;
421
457
  }
422
458
 
423
- function without(array, ...values) {
424
- const valuesSet = new Set(values);
425
- return array.filter(item => !valuesSet.has(item));
426
- }
427
-
428
- function head(arr) {
429
- return arr[0];
430
- }
431
-
432
- function isSubset(superset, subset) {
433
- return difference(subset, superset).length === 0;
434
- }
435
-
436
- function tail(arr) {
437
- return arr.slice(1);
438
- }
439
-
440
- function toFilled(arr, value, start = 0, end = arr.length) {
441
- const length = arr.length;
442
- const finalStart = Math.max(start >= 0 ? start : length + start, 0);
443
- const finalEnd = Math.min(end >= 0 ? end : length + end, length);
444
- const newArr = arr.slice();
445
- for (let i = finalStart; i < finalEnd; i++) {
446
- newArr[i] = value;
447
- }
448
- return newArr;
449
- }
450
-
451
- function last(arr) {
452
- return arr[arr.length - 1];
453
- }
454
-
455
- function initial(arr) {
456
- return arr.slice(0, -1);
457
- }
458
-
459
459
  exports.at = at;
460
460
  exports.chunk = chunk;
461
461
  exports.compact = compact;