mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Use baseGet in parent and _.result.
This commit is contained in:
@@ -5390,7 +5390,7 @@
|
|||||||
* @returns {*} Returns the parent value.
|
* @returns {*} Returns the parent value.
|
||||||
*/
|
*/
|
||||||
function parent(object, path) {
|
function parent(object, path) {
|
||||||
return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
|
return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11872,7 +11872,7 @@
|
|||||||
function result(object, path, defaultValue) {
|
function result(object, path, defaultValue) {
|
||||||
if (!isKey(path, object)) {
|
if (!isKey(path, object)) {
|
||||||
path = baseCastPath(path);
|
path = baseCastPath(path);
|
||||||
var result = get(object, path);
|
var result = baseGet(object, path);
|
||||||
object = parent(object, path);
|
object = parent(object, path);
|
||||||
} else {
|
} else {
|
||||||
result = object == null ? undefined : object[path];
|
result = object == null ? undefined : object[path];
|
||||||
|
|||||||
Reference in New Issue
Block a user