source: node_modules/es-toolkit/dist/compat/array/slice.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 703 bytes
Line 
1/**
2 * Create a slice of `array` from `start` up to, but not including, `end`.
3 *
4 * It does not return a dense array for sparse arrays unlike the native `Array.prototype.slice`.
5 *
6 * @template T - The type of the array elements.
7 * @param {ArrayLike<T> | null | undefined} array - The array to slice.
8 * @param {number} [start=0] - The start position.
9 * @param {number} [end=array.length] - The end position.
10 * @returns {T[]} - Returns the slice of `array`.
11 *
12 * @example
13 * slice([1, 2, 3], 1, 2); // => [2]
14 * slice(new Array(3)); // => [undefined, undefined, undefined]
15 */
16declare function slice<T>(array: ArrayLike<T> | null | undefined, start?: number, end?: number): T[];
17
18export { slice };
Note: See TracBrowser for help on using the repository browser.