UNPKG

array-intersect

Version:

[![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)

22 lines (17 loc) 640 B
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.ArrayIntersect = factory()); }(this, (function () { 'use strict'; var intersect = function intersect(first) { for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { rest[_key - 1] = arguments[_key]; } return rest.reduce(function (accum, current) { return accum.filter(function (x) { return current.indexOf(x) !== -1; }); }, first); }; return intersect; })));