Skip to content

Commit

Permalink
Fixes jashkenas#982. Fixing to have a lower defined behavior bound of 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jul 6, 2013
1 parent e8cee37 commit bec68aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ $(document).ready(function() {

equal(testAfter(5, 5), 1, "after(N) should fire after being called N times");
equal(testAfter(5, 4), 0, "after(N) should not fire unless called N times");
equal(testAfter(0, 0), 1, "after(0) should fire immediately");
equal(testAfter(0, 0), 0, "after(0) should not fire immediately");
equal(testAfter(0, 1), 1, "after(0) should fire when first invoked");
});

});
1 change: 0 additions & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@

// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
if (times <= 0) return func();
return function() {
if (--times < 1) {
return func.apply(this, arguments);
Expand Down

0 comments on commit bec68aa

Please sign in to comment.