array-intersect
Version:
[](https://travis-ci.org/callmecavs/array-intersect) [
22 lines (17 loc) • 640 B
JavaScript
(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;
})));