You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

array-merges

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-merges

Merge arrays under strategy

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

array-merge

Merge arrays under strategy

Example

var merge = require('array-merges');
var arr = merge([{a: 1}], [{a: 1}], {
  equal: function(prev, next) {
    return prev.a === next.a;
  },
  onMerge: function(prev, next) {
    return [prev, next];
  }
});
console.log(arr); // [{a: 1}, {a: 1}]

Options

  • options.equal: Function used to make comparation. Default is
function (prev, next) {
  return prev === next;
}
  • options.onMerge: Hook that determines the merge result between two elements that are judged as equal. Default is
function(prev, next) {
  return [prev];  // abandon dulicate element
}

Lisence

MIT

Keywords

array

FAQs

Package last updated on 19 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts