mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
18 lines
344 B
JavaScript
18 lines
344 B
JavaScript
function deepFind(obj, path) {
|
|
var paths = path.split('.')
|
|
, current = obj
|
|
, i;
|
|
|
|
for (i = 0; i < paths.length; ++i) {
|
|
if (current[paths[i]] == undefined) {
|
|
return undefined;
|
|
} else {
|
|
current = current[paths[i]];
|
|
}
|
|
}
|
|
return current;
|
|
}
|
|
|
|
module.exports = {
|
|
deepFind: deepFind,
|
|
}; |