mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Improve filter callback
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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,
|
||||
};
|
||||
Reference in New Issue
Block a user