UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

14 lines (12 loc) 237 B
function once(func) { let called = false; let cache; return function (...args) { if (!called) { called = true; cache = func(...args); } return cache; }; } export { once };