From 693704a832fd15c05eab72e7e76afe72aa603794 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 29 Jul 2015 23:22:13 -0700 Subject: [PATCH] Remove argument juggling from `_.before`. --- lodash.js | 8 +------- test/test.js | 12 ------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/lodash.js b/lodash.js index 9754bb075..a2668d4f6 100644 --- a/lodash.js +++ b/lodash.js @@ -6648,13 +6648,7 @@ function before(n, func) { var result; if (typeof func != 'function') { - if (typeof n == 'function') { - var temp = n; - n = func; - func = temp; - } else { - throw new TypeError(FUNC_ERROR_TEXT); - } + throw new TypeError(FUNC_ERROR_TEXT); } return function() { if (--n > 0) { diff --git a/test/test.js b/test/test.js index 57f0f73c6..5a51d52f0 100644 --- a/test/test.js +++ b/test/test.js @@ -1190,18 +1190,6 @@ deepEqual(actual, expected); }); - test('should allow `func` as the first argument', 1, function() { - var count = 0; - - try { - var before = _.before(function() { count++; }, 2); - before(); - before(); - } catch(e) {} - - strictEqual(count, 1); - }); - test('should not set a `this` binding', 2, function() { var before = _.before(2, function() { return ++this.count; }), object = { 'count': 0, 'before': before };