source: node_modules/es-toolkit/dist/compat/array/initial.d.mts@ a762898

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

Added visualizations

  • Property mode set to 100644
File size: 596 bytes
Line 
1/**
2 * Returns a new array containing all elements except the last one from the input array.
3 * If the input array is empty or has only one element, the function returns an empty array.
4 *
5 * @template T The type of elements in the array.
6 * @param {ArrayLike<T> | null | undefined} arr - The input array.
7 * @returns {T[]} A new array containing all but the last element of the input array.
8 *
9 * @example
10 * const arr = [1, 2, 3, 4];
11 * const result = initial(arr);
12 * // result will be [1, 2, 3]
13 */
14declare function initial<T>(arr: ArrayLike<T> | null | undefined): T[];
15
16export { initial };
Note: See TracBrowser for help on using the repository browser.