UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

27 lines (25 loc) 750 B
import { NonNil } from "../internals/types.js"; //#region src/set/compact.d.ts /** * `compact(target)` * * Removes all nullable values (`null` and `undefined`) from the `target` set and returns a new set. * * ```ts * compact(new Set([1, null, 2, undefined])); // Set([1, 2]) * compact(new Set([1, 2, 3])); // Set([1, 2, 3]) * ``` * * ```ts * pipe(new Set([1, null, 2, undefined]), compact()); // Set([1, 2]) * pipe(new Set([1, 2, 3]), compact()); // Set([1, 2, 3]) * ``` */ declare const compact: { <T>(): (target: Set<T>) => Set<NonNil<T>>; <T>(): (target: ReadonlySet<T>) => ReadonlySet<NonNil<T>>; <T>(target: Set<T>): Set<NonNil<T>>; <T>(target: ReadonlySet<T>): ReadonlySet<NonNil<T>>; }; //#endregion export { compact };