-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove reduce
error throwing
#1961
Conversation
@@ -122,9 +122,6 @@ | |||
ok(_.reduce(null, _.noop, 138) === 138, 'handles a null (with initial value) properly'); | |||
equal(_.reduce([], _.noop, undefined), undefined, 'undefined can be passed as a special case'); | |||
equal(_.reduce([_], _.noop), _, 'collection of length one with no initial value returns the first item'); | |||
|
|||
throws(function() { _.reduce([], _.noop); }, TypeError, 'throws an error for empty arrays with no initial value'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update these tests to prove they don't throw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, updated.
94b2961
to
f1428a9
Compare
f1428a9
to
41555ff
Compare
memo = obj[keys ? keys[--index] : --index]; | ||
} | ||
while (index--) { | ||
while (index-- > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to never use the result of a postfix increment/decrement (or use them at all). Let's do while(--index >= 0)
.
Remove `reduce` error throwing
Closes #1858.