array/remove.js

  1. import { remove as _remove } from 'lodash/fp'
  2. import { applyLodashFp } from 'util/applyLodashFp'
  3. /**
  4. * Replaces an array removing elements that predicate returns truthy for 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 {Function} [predicate={@link https://lodash.com/docs#identity|lodash.identity}] The function invoked per iteration.
  10. * @return {Object} Returns the updated object.
  11. * @example remove({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', v => v > 2) // => { nested: { prop: [1, 2] } }
  12. * @see {@link https://lodash.com/docs#remove|lodash.remove} for more information.
  13. * @since 1.0.0
  14. */
  15. const remove = applyLodashFp(_remove, { arity: 1 })
  16. export { remove }