intersectarrays

1.1.0 • Public • Published

intersectArrays

Creates array containing values that are present in all provided arrays.

How to use

// returns array of values, that are present in all provided arrays
intersectArrays(['a', 'b'], ['a', 'b', 'c']);  // -> ['a', 'b']
 
// you can provide any number of arrays
intersectArrays(['a', 'b'], ['a', 'c'], ['a', 'd']);  // -> ['a']
 
// resulting array contains unique values, no duplicates
intersectArrays(['a', 'b', 'a'], ['a', 'b', 'b']);  // -> ['a', 'b']
 
// returns an empty array when no parameters are provided
intersectArrays();  // -> []
 
// returns an empty array when any of the parameters is not an array
intersectArrays(['a'], 'a');  // -> []

Bug reports, feature requests and contact

If you found any bugs, if you have feature requests or any questions, please, either file an issue at GitHub or send me an e-mail at riki@fczbkk.com.

License

intersectArrays is published under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i intersectarrays

Weekly Downloads

2

Version

1.1.0

License

MIT

Last publish

Collaborators

  • fczbkk