Skip to content

micro-js/union

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

union

Build status Git tag NPM version Code style

Compute the union of two arrays

Installation

$ npm install @f/union

Usage

var union = require('@f/union')

union([1, 2], [2, 3, 4]) // -> [1, 2, 3, 4]

API

union(a, b, cmp?)

  • a - First array
  • b - Second array
  • cmp - Optional. Comparator to use to reduce the joined array to its unique values.

Returns: Returns the logical union of the two arrays. That is, each unique element in either array, exactly once.

License

MIT