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

14 lines
237 B
JavaScript

function once(func) {
let called = false;
let cache;
return function (...args) {
if (!called) {
called = true;
cache = func(...args);
}
return cache;
};
}
export { once };