-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
Fix #265 #361
Fix #265 #361
Conversation
gregglind
commented
Feb 7, 2015
- We didn't throw on 'too many args' before. Should we now? If so, what?
- (Do docs run as tests, if so how?)
- (Tests inbound. WIP mostly to claim the bug :) )
4db3314
to
0baa6f1
Compare
See #265 |
} | ||
} else { | ||
keys = Array.prototype.slice.call(arguments); | ||
} |
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.
It might read clearer to use the _.type
function:
if (_.type(keys) === 'object') {
keys = Object.keys(keys);
} else if (arguments.length > 1) {
keys = Array.prototype.slice.call(arguments);
}
0baa6f1
to
2b46e95
Compare
Went to switch based, using |
? keys | ||
: Array.prototype.slice.call(arguments); | ||
, ok = true | ||
, mixedArgsMsg = "keys: if first argument is instanceof Array|Object, must be only argument." |
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 think this error needs rephrasing, maybe to something like 'keys must be given single argument of Array, Object, or multiple String arguments'
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.
Rephased to:
var mixedArgsMsg = 'keys must be given single argument of Array|Object|String, or multiple String arguments'
I think that is accurate. I do wonder if we should emphasize the 'multiple arguments' part, because that is what triggered the error.
- `.keys(object)n => .keys(Object.keys(Object)` - added exceptions for 'if first arg is non-string, then it must be only arg. => `.keys(Array|Object, ...)` Warning: `Object.keys` must exist on systems to use this functionality.
2b46e95
to
4f40b37
Compare
I'd say this is good to go. Let's get it merged in. 👍 |