|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
404 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | function after(n, func) {
|
|---|
| 6 | if (!Number.isInteger(n) || n < 0) {
|
|---|
| 7 | throw new Error(`n must be a non-negative integer.`);
|
|---|
| 8 | }
|
|---|
| 9 | let counter = 0;
|
|---|
| 10 | return (...args) => {
|
|---|
| 11 | if (++counter >= n) {
|
|---|
| 12 | return func(...args);
|
|---|
| 13 | }
|
|---|
| 14 | return undefined;
|
|---|
| 15 | };
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | exports.after = after;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.