collection/reject.js

  1. import { reject as _reject } from 'lodash'
  2. import { apply } from 'immutadot/core'
  3. /**
  4. * Replaces by an array of elements <code>predicate</code> returns falsy for.
  5. * @function
  6. * @memberof collection
  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. * @see {@link https://lodash.com/docs#reject|lodash.reject} for more information.
  12. * @example reject({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', v => v % 2) // => { nested: { prop: [2, 4] } }
  13. * @since 1.0.0
  14. */
  15. const reject = apply(_reject, { arity: 1 })
  16. export { reject }