es-toolkit 1.13.1-dev.302 → 1.13.1-dev.303
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/array/index.js +2 -2
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +1 -1
- package/dist/array/takeRight.d.mts +2 -2
- package/dist/array/takeRight.d.ts +2 -2
- package/dist/array/takeRight.js +2 -2
- package/dist/array/takeRight.js.map +1 -1
- package/dist/array/takeRight.mjs +1 -1
- package/dist/browser.js +2 -2
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +2 -2
- package/dist/{chunk-BVNAXMKC.mjs → chunk-JNHWGDYT.mjs} +2 -2
- package/dist/{chunk-IQLKIDXF.mjs → chunk-N3QYJX4T.mjs} +3 -3
- package/dist/chunk-N3QYJX4T.mjs.map +1 -0
- package/dist/compat/index.js +2 -2
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/umd/browser.global.js +1 -1
- package/dist/chunk-IQLKIDXF.mjs.map +0 -1
- /package/dist/{chunk-BVNAXMKC.mjs.map → chunk-JNHWGDYT.mjs.map} +0 -0
package/dist/browser.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compat_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JNHWGDYT.mjs";
|
|
4
4
|
import "./chunk-NKLIE2OI.mjs";
|
|
5
5
|
import "./chunk-XT74R35S.mjs";
|
|
6
6
|
import "./chunk-EYYZQFOP.mjs";
|
|
@@ -63,7 +63,7 @@ import "./chunk-SYWMYQYJ.mjs";
|
|
|
63
63
|
import "./chunk-G7UQ5PUR.mjs";
|
|
64
64
|
import "./chunk-TJ4Z5I7M.mjs";
|
|
65
65
|
import "./chunk-ME352XO7.mjs";
|
|
66
|
-
import "./chunk-
|
|
66
|
+
import "./chunk-N3QYJX4T.mjs";
|
|
67
67
|
import "./chunk-NTLX2MPV.mjs";
|
|
68
68
|
import "./chunk-2IXFGSUA.mjs";
|
|
69
69
|
import "./chunk-O6UXZR3U.mjs";
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
} from "./chunk-ME352XO7.mjs";
|
|
157
157
|
import {
|
|
158
158
|
takeRight
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-N3QYJX4T.mjs";
|
|
160
160
|
import {
|
|
161
161
|
takeRightWhile
|
|
162
162
|
} from "./chunk-NTLX2MPV.mjs";
|
|
@@ -602,4 +602,4 @@ export {
|
|
|
602
602
|
min,
|
|
603
603
|
compat_exports
|
|
604
604
|
};
|
|
605
|
-
//# sourceMappingURL=chunk-
|
|
605
|
+
//# sourceMappingURL=chunk-JNHWGDYT.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/array/takeRight.ts
|
|
2
|
-
function takeRight(arr, count) {
|
|
3
|
-
if (count
|
|
2
|
+
function takeRight(arr, count = 1) {
|
|
3
|
+
if (count <= 0) {
|
|
4
4
|
return [];
|
|
5
5
|
}
|
|
6
6
|
return arr.slice(-count);
|
|
@@ -9,4 +9,4 @@ function takeRight(arr, count) {
|
|
|
9
9
|
export {
|
|
10
10
|
takeRight
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-N3QYJX4T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/takeRight.ts"],"sourcesContent":["/**\n * Returns a new array containing the last `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to take elements from.\n * @param {number} [count=1] - The number of elements to take.\n * @returns {T[]} A new array containing the last `count` elements from `arr`.\n *\n * @example\n * // Returns [4, 5]\n * takeRight([1, 2, 3, 4, 5], 2);\n *\n * @example\n * // Returns ['b', 'c']\n * takeRight(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * takeRight([1, 2, 3], 5);\n */\nexport function takeRight<T>(arr: readonly T[], count = 1): T[] {\n if (count <= 0) {\n return [];\n }\n\n return arr.slice(-count);\n}\n"],"mappings":";AAqBO,SAAS,UAAa,KAAmB,QAAQ,GAAQ;AAC9D,MAAI,SAAS,GAAG;AACd,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,IAAI,MAAM,CAAC,KAAK;AACzB;","names":[]}
|
package/dist/compat/index.js
CHANGED