Skip to content

Commit

Permalink
fix: merge helper returns modified object, leftovers removed
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jun 30, 2020
1 parent e4ecaf0 commit 2e3339b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/helpers/merge.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-restricted-syntax, no-param-reassign */

const isPlainObject = require('./is_plain_object');

function merge(...sources) {
const target = {};
function merge(target, ...sources) {
for (const source of sources) {
if (!isPlainObject(source)) {
continue; // eslint-disable-line no-continue
Expand All @@ -20,4 +19,4 @@ function merge(...sources) {
return target;
}

module.exports = merge.bind(undefined, false);
module.exports = merge;

0 comments on commit 2e3339b

Please sign in to comment.