UNPKG

wellcrafted

Version:

Delightful TypeScript patterns for elegant, type-safe applications

28 lines (26 loc) 874 B
import { Err, Ok, Result } from "./result-_socO0Ud.js"; //#region src/result/utils.d.ts /** * Partitions an array of Result objects into two separate arrays based on their status. * * @template T - The success type * @template E - The error type * @param results - An array of Result objects to partition * @returns An object containing two arrays: * - `oks`: Array of successful Result objects (Ok<T>[]) * - `errs`: Array of error Result objects (Err<E>[]) * * @example * const results = [Ok(1), Err("error"), Ok(2)]; * const { oks, errs } = partitionResults(results); * // oks = [Ok(1), Ok(2)] * // errs = [Err("error")] */ declare function partitionResults<T, E>(results: Result<T, E>[]): { oks: Ok<T>[]; errs: Err<E>[]; }; //# sourceMappingURL=utils.d.ts.map //#endregion export { partitionResults }; //# sourceMappingURL=index-D0f5JWiT.d.ts.map