Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 10, 2019
1 parent 2d7bbf4 commit dda94ac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/merge.js
Original file line number Diff line number Diff line change
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 dda94ac

Please sign in to comment.