UNPKG

typedash

Version:

modern, type-safe collection of utility functions

20 lines (19 loc) 1.25 kB
import { t as Maybe } from "./Maybe-pvX1mStM.js"; //#region src/functions/partition/partition.d.ts /** * Partitions an array into two arrays based on a predicate function. * @param array The input array to partition. * @param predicate A function that takes an array item and returns a boolean indicating whether the item should be included in the "equals" array or the "notEquals" array. * @returns A tuple containing two arrays: the "equals" array and the "notEquals" array. */ declare function partition<T, S extends T>(array: Maybe<readonly T[]>, predicate: (item: T) => item is S): readonly [equals: S[], notEquals: Exclude<T, S>[]]; /** * Partitions an array into two arrays based on a predicate function. * @param array The input array to partition. * @param predicate A function that takes an array item and returns a boolean indicating whether the item should be included in the "equals" array or the "notEquals" array. * @returns A tuple containing two arrays: the "equals" array and the "notEquals" array. */ declare function partition<T>(array: Maybe<readonly T[]>, predicate: (item: T) => boolean): readonly [equals: T[], notEquals: T[]]; //#endregion export { partition as t }; //# sourceMappingURL=partition-DRZEjBbn.d.ts.map