es-toolkit 1.39.7-dev.1479 → 1.39.7-dev.1481

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.
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @param {T[]} arr - The array to take elements from.
8
8
  * @param {number} count - The number of elements to take.
9
+ * @param {unknown} guard - If truthy, ignores `count` and defaults to 1.
9
10
  * @returns {T[]} A new array containing the first `count` elements from `arr`.
10
11
  *
11
12
  * @example
@@ -19,6 +20,11 @@
19
20
  * @example
20
21
  * // Returns [1, 2, 3]
21
22
  * take([1, 2, 3], 5);
23
+ *
24
+ * @example
25
+ * // Returns [[1], [1], [1]]
26
+ * const arr = [1, 2, 3];
27
+ * const result = arr.map((v, i, array) => take(array, i, true));
22
28
  */
23
29
  declare function take<T>(arr: readonly T[], count?: number, guard?: unknown): T[];
24
30
 
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @param {T[]} arr - The array to take elements from.
8
8
  * @param {number} count - The number of elements to take.
9
+ * @param {unknown} guard - If truthy, ignores `count` and defaults to 1.
9
10
  * @returns {T[]} A new array containing the first `count` elements from `arr`.
10
11
  *
11
12
  * @example
@@ -19,6 +20,11 @@
19
20
  * @example
20
21
  * // Returns [1, 2, 3]
21
22
  * take([1, 2, 3], 5);
23
+ *
24
+ * @example
25
+ * // Returns [[1], [1], [1]]
26
+ * const arr = [1, 2, 3];
27
+ * const result = arr.map((v, i, array) => take(array, i, true));
22
28
  */
23
29
  declare function take<T>(arr: readonly T[], count?: number, guard?: unknown): T[];
24
30
 
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.39.7-dev.1479+e44ecd57",
4
+ "version": "1.39.7-dev.1481+5379db2c",
5
5
  "homepage": "https://es-toolkit.dev",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {