Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

pullAllBy.js 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. var baseIteratee = require('./_baseIteratee'),
  2. basePullAll = require('./_basePullAll');
  3. /**
  4. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  5. * invoked for each element of `array` and `values` to generate the criterion
  6. * by which they're compared. The iteratee is invoked with one argument: (value).
  7. *
  8. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  9. *
  10. * @static
  11. * @memberOf _
  12. * @since 4.0.0
  13. * @category Array
  14. * @param {Array} array The array to modify.
  15. * @param {Array} values The values to remove.
  16. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17. * @returns {Array} Returns `array`.
  18. * @example
  19. *
  20. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  21. *
  22. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  23. * console.log(array);
  24. * // => [{ 'x': 2 }]
  25. */
  26. function pullAllBy(array, values, iteratee) {
  27. return (array && array.length && values && values.length)
  28. ? basePullAll(array, values, baseIteratee(iteratee, 2))
  29. : array;
  30. }
  31. module.exports = pullAllBy;