@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
14 lines • 512 B
TypeScript
/**
* @callback OnceCallback
* @param {...any} args
* @returns {any}
*/
/**
* Ensures a function is only called once, caching its result.
* @template T
* @param {OnceCallback} callback - The function to call once.
* @returns {(...args: Parameters<T>) => ReturnType<T>} The wrapped function.
* @throws {TypeError} If callback is not a function.
*/
export default function once<T extends (...args: any[]) => any>(callback: T): (...args: Parameters<T>) => ReturnType<T>;
//# sourceMappingURL=once.d.ts.map