whereIn.js 369 B

12345678910111213
  1. 'use strict';
  2. var extractValues = require('../helpers/values');
  3. var nestedValue = require('../helpers/nestedValue');
  4. module.exports = function whereIn(key, values) {
  5. var items = extractValues(values);
  6. var collection = this.items.filter(function (item) {
  7. return items.indexOf(nestedValue(item, key)) !== -1;
  8. });
  9. return new this.constructor(collection);
  10. };