Files
doneit-web/src/plugin/deep.js
T

18 lines
344 B
JavaScript
Raw Normal View History

2022-01-10 22:04:04 +01:00
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 = {
2022-01-13 11:43:36 +01:00
deepFind: deepFind,
2022-01-10 22:04:04 +01:00
};