mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
_.barrier + tests
This commit is contained in:
@@ -510,6 +510,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
// Returns a function that will only be executed after being called N times.
|
||||
_.barrier = function(func, times) {
|
||||
return function() {
|
||||
if (--times === 0) { return func.apply(this, arguments); }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Object Functions
|
||||
// ----------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user