array/pull.js

  1. import { pull as _pull } from 'lodash/fp'
  2. import { applyLodashFp } from 'util/applyLodashFp'
  3. /**
  4. * Replaces an array removing all given values from the former array.
  5. * @function
  6. * @memberof array
  7. * @param {Object} object The object to modify.
  8. * @param {Array|string} path The path of the property to set.
  9. * @param {...*} values The values to remove.
  10. * @return {Object} Returns the updated object.
  11. * @example pull({ nested: { prop: [1, 2, 3, 1, 2, 3] } }, 'nested.prop', 1, 3) // => { nested: { prop: [2, 2] } }
  12. * @see {@link https://lodash.com/docs#pull|lodash.pull} for more information.
  13. * @since 1.0.0
  14. */
  15. const pull = applyLodashFp(_pull, { arity: 2 })
  16. export { pull }