2018-09-14 08:32:17 +00:00
|
|
|
function resolveSingleObjectGetters (object) {
|
|
|
|
if (object && typeof object === 'object') {
|
|
|
|
const newObject = {}
|
2020-03-17 20:17:55 +00:00
|
|
|
for (const key in object) { // eslint-disable-line guard-for-in
|
2018-09-14 08:32:17 +00:00
|
|
|
newObject[key] = resolveGetters(object[key])[0]
|
|
|
|
}
|
|
|
|
return newObject
|
|
|
|
}
|
|
|
|
return object
|
|
|
|
}
|
|
|
|
|
2018-09-14 06:41:21 +00:00
|
|
|
function resolveGetters (...args) {
|
2018-09-14 08:32:17 +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
|
2018-09-14 06:38:44 +00:00
|
|
|
}
|