/** * Spec where each key maps to a function that will be called with the input. */ export type ApplySpecSpec = { [K in keyof R]: (input: T) => R[K]; }; /** * Create a function that applies a spec of functions to an input, * returning an object with the results. * * @param spec - Object where values are functions to apply * @returns Function that applies all spec functions to its input * * @example * const getStats = applySpecFast({ * min: (arr: number[]) => Math.min(...arr), * max: (arr: number[]) => Math.max(...arr), * sum: (arr: number[]) => arr.reduce((a, b) => a + b, 0), * }); * getStats([1, 2, 3, 4, 5]); // { min: 1, max: 5, sum: 15 } * * @example * const parseUser = applySpecFast({ * name: (u: RawUser) => u.firstName + ' ' + u.lastName, * age: (u: RawUser) => new Date().getFullYear() - u.birthYear, * }); */ export declare function applySpecFast(spec: ApplySpecSpec): (input: T) => R; //# sourceMappingURL=applySpec.d.ts.map