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.

29 line
710 B

3 年之前
  1. var basePullAll = require('./_basePullAll');
  2. /**
  3. * This method is like `_.pull` except that it accepts an array of values to remove.
  4. *
  5. * **Note:** Unlike `_.difference`, this method mutates `array`.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 4.0.0
  10. * @category Array
  11. * @param {Array} array The array to modify.
  12. * @param {Array} values The values to remove.
  13. * @returns {Array} Returns `array`.
  14. * @example
  15. *
  16. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  17. *
  18. * _.pullAll(array, ['a', 'c']);
  19. * console.log(array);
  20. * // => ['b', 'b']
  21. */
  22. function pullAll(array, values) {
  23. return (array && array.length && values && values.length)
  24. ? basePullAll(array, values)
  25. : array;
  26. }
  27. module.exports = pullAll;