Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 14, 2019
1 parent e24dcf5 commit bb9bf21
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/merge.js
Expand Up @@ -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 = []) {
Expand All @@ -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;
Expand Down

0 comments on commit bb9bf21

Please sign in to comment.