2018-09-14 08:32:17 +00:00
|
|
|
function resolveSingleObjectGetters (object) {
|
|
|
|
if (object && typeof object === 'object') {
|
2020-03-20 20:28:31 +00:00
|
|
|
const newObject = {};
|
2020-03-17 20:17:55 +00:00
|
|
|
for (const key in object) { // eslint-disable-line guard-for-in
|
2020-03-20 20:28:31 +00:00
|
|
|
newObject[key] = resolveGetters(object[key])[0];
|
2018-09-14 08:32:17 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return newObject;
|
2018-09-14 08:32:17 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return object;
|
2018-09-14 08:32:17 +00:00
|
|
|
}
|
|
|
|
|
2018-09-14 06:41:21 +00:00
|
|
|
function resolveGetters (...args) {
|
2020-03-20 20:28:31 +00:00
|
|
|
return args.map(resolveSingleObjectGetters);
|
2018-09-14 06:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2018-09-14 06:41:21 +00:00
|
|
|
resolveGetters
|
2020-03-20 20:28:31 +00:00
|
|
|
};
|