New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

array-intersect

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-intersect

[![array-intersect on Travis](https://img.shields.io/travis/callmecavs/array-intersect.svg?style=flat-square)](https://travis-ci.org/callmecavs/array-intersect) [![array-intersect on NPM](https://img.shields.io/npm/v/array-intersect.svg?style=flat-square)

0.0.1
latest
Source
npm
Version published
Weekly downloads
7.2K
-2.34%
Maintainers
1
Weekly downloads
 
Created
Source

array-intersect

array-intersect on Travis array-intersect on NPM array-intersect Downloads on NPM Standard JavaScript Style

Install

$ npm i array-intersect --save

Use

Pass any number of arrays as arguments.

Expects that:

  • Array items are unique (deduped)
  • Array items are primitive types
import intersect from 'array-intersect'

const simple = intersect(
  [1, 2, 3],
  [2, 3, 4]
)

const complex = intersect(
  [0, 1, 2, 3],
  [1, 2, 3, 4],
  [2, 3, 4, 5]
)

console.log(simple)            // [2, 3]
console.log(complex)           // [2, 3]

Browser Support

Requires support for ES5 Array Methods.

License

MIT. © 2018 Michael Cavalea

Keywords

array

FAQs

Package last updated on 06 Aug 2018

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