|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
332 bytes
|
| Line | |
|---|
| 1 | import { toInteger } from '../util/toInteger.mjs';
|
|---|
| 2 |
|
|---|
| 3 | function after(n, func) {
|
|---|
| 4 | if (typeof func !== 'function') {
|
|---|
| 5 | throw new TypeError('Expected a function');
|
|---|
| 6 | }
|
|---|
| 7 | n = toInteger(n);
|
|---|
| 8 | return function (...args) {
|
|---|
| 9 | if (--n < 1) {
|
|---|
| 10 | return func.apply(this, args);
|
|---|
| 11 | }
|
|---|
| 12 | };
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | export { after };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.