2018-09-14 11:32:17 +03:00
|
|
|
function resolveSingleObjectGetters (object) {
|
|
|
|
if (object && typeof object === 'object') {
|
|
|
|
const newObject = {}
|
|
|
|
for (const key in object) {
|
|
|
|
newObject[key] = resolveGetters(object[key])[0]
|
|
|
|
}
|
|
|
|
return newObject
|
|
|
|
}
|
|
|
|
return object
|
|
|
|
}
|
|
|
|
|
2018-09-14 09:41:21 +03:00
|
|
|
function resolveGetters (...args) {
|
2018-09-14 11:32:17 +03:00
|
|
|
return args.map(resolveSingleObjectGetters)
|
2018-09-14 09:36:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2018-09-14 09:41:21 +03:00
|
|
|
resolveGetters
|
2018-09-14 09:38:44 +03:00
|
|
|
}
|