You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
335 B

4 years ago
  1. 'use strict';
  2. module.exports = function intersect(values) {
  3. var intersectValues = values;
  4. if (values instanceof this.constructor) {
  5. intersectValues = values.all();
  6. }
  7. var collection = this.items.filter(function (item) {
  8. return intersectValues.indexOf(item) !== -1;
  9. });
  10. return new this.constructor(collection);
  11. };