-
Notifications
You must be signed in to change notification settings - Fork 0
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
Speed ups #3
Speed ups #3
Conversation
_.restParams = function rest(func, startIndex) { | ||
startIndex = startIndex != null ? +startIndex : 1; | ||
_.restParams = function(func) { | ||
var startIndex = func.length - 1; |
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.
What sense would it be to have it be anything but the last arg? The whole method would have to be rewritten to support it any place else.
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.
Consider something like
var restArgs = _.restParams(_.rest, 0);
restArgs(1,2,3,4,5,6,7);
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.
Won't that lose I see what you're saying now.guard
?
We could default...
_.restParams = function(func, startIndex) {
startIndex = startIndex == null ? func.length - 1 : startIndex
};
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.
Yeah that's reasonable.
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.
Fixed.
So we can discuss.