From 2b2c7d7f9f587562d269b7669daa103120ccaab5 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 2 Nov 2017 21:29:17 -0400 Subject: [PATCH] fix object serialization test issue --- lib/renderer/api/remote.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index 1e4c292ac834..01a30c44d6ce 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -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 }