Refactor the custom helpers into their own files
This commit is contained in:
parent
af2df4f7c5
commit
0392d339db
7 changed files with 69 additions and 62 deletions
11
module/helpers/objectValue.mjs
Normal file
11
module/helpers/objectValue.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export function objectValue(obj, keypath) {
|
||||
function helper(o, k) {
|
||||
let v = o[k[0]];
|
||||
if (typeof v === "object") {
|
||||
return helper(v, k.slice(1));
|
||||
};
|
||||
return v;
|
||||
};
|
||||
let resp = helper(obj, keypath.string.split(`.`));
|
||||
return resp;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue