source: node_modules/es-toolkit/dist/function/once.js@ ba17441

Last change on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 330 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5function once(func) {
6 let called = false;
7 let cache;
8 return function (...args) {
9 if (!called) {
10 called = true;
11 cache = func(...args);
12 }
13 return cache;
14 };
15}
16
17exports.once = once;
Note: See TracBrowser for help on using the repository browser.