Skip to content

wabg/merge-array-object

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

merge

CI npm version NPM Downloads Coverage Status

Concat array and merge object

Install

npm i merge-array-object

Usage

var merge = require('merge-array-object');

var a = {a: [1], b: 1, c: 1 }; 
var b = {a: [2], b: 2, d: 2 };

var result = merge(a,b);

// result
{
  a: [1, 2],
  b: 2,
  c: 1,
  d: 2
}

noDuplicates

var a = {ary: ['foo', 'bar']};
var b = {ary: ['bar', 'baz']};

console.log(merge.noDuplicates(b, a));  // {ary: ['foo', 'bar', 'baz']}
console.log(merge(b, a));               // {ary: ['foo', 'bar', 'bar', 'baz']}

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

Licensed under the MIT License.