fix object serialization test issue

This commit is contained in:
Shelley Vohr 2017-11-02 21:29:17 -04:00
parent 5c318932c2
commit 2b2c7d7f9f
No known key found for this signature in database
GPG key ID: F13993A75599653C

View file

@ -248,15 +248,11 @@ function metaToValue (meta) {
// Construct a plain object from the meta.
function metaToPlainObject (meta) {
if (meta.type === 'error') return new Error()
const obj = {}
const members = meta.members
members.forEach((member) => {
const {key, value} = member
obj[key] = value
})
const obj = (() => meta.type === 'error' ? new Error() : {})()
for (let i = 0; i < meta.members.length; i++) {
let {name, value} = meta.members[i]
obj[name] = value
}
return obj
}