Files
wticreatorstudio/Modules/Frontend/Resources/client/api/useData.js
T

17 lines
336 B
JavaScript

export function useData() {
function getData(name, key) {
let obj = window[name];
return key.split(".").reduce((o, k) => {
if (o && typeof o === 'object' && k in o) {
return o[k];
}
return undefined;
}, obj);
}
return {
getData,
};
}