source: node_modules/es-toolkit/dist/function/after.mjs

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

Added visualizations

  • Property mode set to 100644
File size: 310 bytes
RevLine 
[a762898]1function after(n, func) {
2 if (!Number.isInteger(n) || n < 0) {
3 throw new Error(`n must be a non-negative integer.`);
4 }
5 let counter = 0;
6 return (...args) => {
7 if (++counter >= n) {
8 return func(...args);
9 }
10 return undefined;
11 };
12}
13
14export { after };
Note: See TracBrowser for help on using the repository browser.