From dda94ac75a6e08a2b14051392ef8a1fb3ecb9262 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Mon, 10 Jun 2019 10:00:00 +0200 Subject: [PATCH] Rename variables --- lib/merge.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/merge.js b/lib/merge.js index 132d12500c..0913323747 100644 --- a/lib/merge.js +++ b/lib/merge.js @@ -3,8 +3,8 @@ // Merge two objects, including their prototypes function mergePrototypes(to, from) { const prototypes = [...getPrototypes(to), ...getPrototypes(from)]; - const newPrototype = prototypes.reduce(reducePrototype, {}); - return Object.assign(Object.setPrototypeOf(to, newPrototype), to, from); + const prototype = prototypes.reduce(shallowMerge, {}); + return Object.assign(Object.setPrototypeOf(to, prototype), from); } function getPrototypes(object, prototypes = []) { @@ -16,8 +16,8 @@ function getPrototypes(object, prototypes = []) { return prototypes; } -function reducePrototype(prototype, constructor) { - return Object.defineProperties(prototype, Object.getOwnPropertyDescriptors(constructor)); +function shallowMerge(toObject, fromObject) { + return Object.defineProperties(toObject, Object.getOwnPropertyDescriptors(fromObject)); } module.exports = mergePrototypes;