array/pullAllBy.js

  1. import { pullAllBy as _pullAllBy } from 'lodash/fp'
  2. import { applyLodashFp } from 'util/applyLodashFp'
  3. /**
  4. * This method is like {@link array.pullAll} except that it accepts <code>iteratee</code> to generate the criterion by which each element is compared.
  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 {Array} values The values to remove.
  10. * @param {Function} [iteratee={@link https://lodash.com/docs#identity|lodash.identity}] The iteratee invoked per element.
  11. * @return {Object} Returns the updated object.
  12. * @example pullAllBy({ nested: { prop: [{ x: 1 }, { x: 2 }, { x: 3 }, { x: 1 }, { x: 2 }, { x: 3 }] } }, 'nested.prop', [{ x: 1 }, { x: 3 }], 'x') // => { nested: { prop: [{ x: 2 }, { x: 2 }] } }
  13. * @see {@link https://lodash.com/docs#pullAllBy|lodash.pullAllBy} for more information.
  14. * @since 1.0.0
  15. */
  16. const pullAllBy = applyLodashFp(_pullAllBy, { arity: 2 })
  17. export { pullAllBy }