mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:57:08 +00:00
deepValue with an empty path returns the object itself
This commit is contained in:
@@ -215,7 +215,11 @@ function deepValue (obj, path) {
|
||||
if (obj !== undefined) {
|
||||
const key = path.shift();
|
||||
if (!path.length) {
|
||||
return obj[key];
|
||||
if (key === undefined) {
|
||||
return obj;
|
||||
} else {
|
||||
return obj[key];
|
||||
}
|
||||
} else {
|
||||
return deepValue(obj[key], path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user