mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Ensure _.result calls deep function with correct context.
This commit is contained in:
committed by
jdalton
parent
c594bda77f
commit
11ab3034b1
@@ -9820,7 +9820,11 @@
|
||||
* // => 'busy'
|
||||
*/
|
||||
function result(object, path, defaultValue) {
|
||||
var value = object == null ? undefined : getProperty(object, path);
|
||||
path = toPath(path);
|
||||
if (path.length > 1) {
|
||||
object = getPath(object, dropRight(path));
|
||||
}
|
||||
var value = getProperty(object, last(path));
|
||||
if (typeof value == 'undefined') {
|
||||
value = defaultValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user