mirror of
https://github.com/stCarolas/setup-maven.git
synced 2024-11-23 11:36:08 +08:00
13 lines
300 B
JavaScript
13 lines
300 B
JavaScript
// Returns a function that will only be executed up to (but not including) the
|
|
// Nth call.
|
|
export default function before(times, func) {
|
|
var memo;
|
|
return function() {
|
|
if (--times > 0) {
|
|
memo = func.apply(this, arguments);
|
|
}
|
|
if (times <= 1) func = null;
|
|
return memo;
|
|
};
|
|
}
|