-
-
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
[#2286]: Underscore could use a _.propertyResult #2531
base: master
Are you sure you want to change the base?
Conversation
underscore.js
Outdated
// referenced object. | ||
_.method = function(value) { | ||
var isFunction = this.isFunction, | ||
rest = this.rest, |
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.
use restArgs
instead
@megawac Thanks for the quality feedback. Updated diff addresses:
|
underscore.js
Outdated
|
||
return restArgs(function(obj, args) { | ||
if (obj == null) { return; } | ||
func = isFunctionLiteral ? value : obj[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.
define func
here rather than outer scope
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.
Thanks, updated diff with this change.
fyi lodash/method. |
…ctions on an Object. Closes jashkenas#2286: Underscore could use a _.propertyResult.
I chose the name _.method per the above suggestion, but am happy to adjust if this does not match the project guidelines.
Fixes #2286