5e4e50c5eb
* fix: remove bad usages of for-in and guard against it * Apply suggestions from code review Co-Authored-By: Samuel Maddock <samuel.maddock@gmail.com> * Apply suggestions from code review Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org> * Update remote.js Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com> Co-authored-by: Jeremy Apthorp <jeremya@chromium.org>
18 lines
413 B
JavaScript
18 lines
413 B
JavaScript
function resolveSingleObjectGetters (object) {
|
|
if (object && typeof object === 'object') {
|
|
const newObject = {}
|
|
for (const key in object) { // eslint-disable-line guard-for-in
|
|
newObject[key] = resolveGetters(object[key])[0]
|
|
}
|
|
return newObject
|
|
}
|
|
return object
|
|
}
|
|
|
|
function resolveGetters (...args) {
|
|
return args.map(resolveSingleObjectGetters)
|
|
}
|
|
|
|
module.exports = {
|
|
resolveGetters
|
|
}
|