typedash
Version:
modern, type-safe collection of utility functions
23 lines (22 loc) • 759 B
TypeScript
import { t as Maybe } from "./Maybe-pvX1mStM.js";
//#region src/types/Falsey.d.ts
/**
* A type that represents all the falsey values in JavaScript.
*/
type Falsey = null | undefined | false | '' | 0 | 0n;
//#endregion
//#region src/functions/compact/compact.d.ts
/**
* Creates an array with all falsey values removed.
* The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are falsey.
* @param array The array to compact.
* @returns The new array of filtered values.
* @example
* ```ts
* compact([0, 1, false, 2, '', 3, null, 4, undefined]) // [1, 2, 3, 4]
* ```
*/
declare function compact<T>(array: Maybe<ReadonlyArray<T | Falsey>>): T[];
//#endregion
export { Falsey as n, compact as t };
//# sourceMappingURL=compact-C1HLCjxl.d.ts.map