Files
cannaiq/frontend/node_modules/es-toolkit/dist/function/once.d.ts
2025-11-28 19:45:44 -07:00

18 lines
521 B
TypeScript

/**
* Creates a function that is restricted to invoking func once. Repeat calls to the function return the value of the first invocation.
*
* @template F - The type of the function.
* @param {F} func - The function to restrict.
* @returns {F} Returns the new restricted function.
*
* @example
* const initialize = once(createApplication);
*
* initialize();
* initialize();
* // => `createApplication` is invoked once
*/
declare function once<F extends (...args: any[]) => any>(func: F): F;
export { once };