source: node_modules/es-toolkit/dist/compat/array/compact.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: 630 bytes
Line 
1type Falsey = false | null | 0 | 0n | '' | undefined;
2/**
3 * Removes falsey values (false, null, 0, 0n, '', undefined, NaN) from an array.
4 *
5 * @template T - The type of elements in the array.
6 * @param {ArrayLike<T | Falsey> | null | undefined} arr - The input array to remove falsey values.
7 * @returns {Array<Exclude<T, false | null | 0 | 0n | '' | undefined>>} - A new array with all falsey values removed.
8 *
9 * @example
10 * compact([0, 0n, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);
11 * Returns: [1, 2, 3, 4, 5]
12 */
13declare function compact<T>(arr: ArrayLike<T | Falsey> | null | undefined): T[];
14
15export { compact };
Note: See TracBrowser for help on using the repository browser.