|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
300 bytes
|
| Line | |
|---|
| 1 | // Returns a function that will only be executed up to (but not including) the
|
|---|
| 2 | // Nth call.
|
|---|
| 3 | export default function before(times, func) {
|
|---|
| 4 | var memo;
|
|---|
| 5 | return function() {
|
|---|
| 6 | if (--times > 0) {
|
|---|
| 7 | memo = func.apply(this, arguments);
|
|---|
| 8 | }
|
|---|
| 9 | if (times <= 1) func = null;
|
|---|
| 10 | return memo;
|
|---|
| 11 | };
|
|---|
| 12 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.