UNPKG

@utilify/core

Version:

Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B

15 lines 647 B
/** * @callback ActionCallback * @param {...any} args * @returns {any} */ /** * Executes an action if the predicate returns true. * @template T * @param {(...args: any) => boolean} predicate - The predicate function. * @param {ActionCallback} action - The action to execute. * @returns {(...args: Parameters<T>) => ReturnType<T> | undefined} The conditional function. * @throws {TypeError} If predicate or action is not a function. */ export default function when<T extends (...args: any) => any>(predicate: (...args: any) => boolean, action: T): (...args: Parameters<T>) => ReturnType<T> | undefined; //# sourceMappingURL=when.d.ts.map