object/pickBy.js

  1. import _pickBy from 'lodash/pickBy'
  2. import convert from '../util/convert'
  3. /**
  4. * Creates an object composed of the object properties predicate returns truthy
  5. * for. The predicate is invoked with two arguments: (value, key).
  6. * @function
  7. * @memberof object
  8. * @param {Object} object The object to modify.
  9. * @param {Array|string} path The path of the property to set.
  10. * @param {function} [predicate={@link https://lodash.com/docs#identity|lodash.identity}] The function invoked per iteration.
  11. * @return {Object} Returns the updated object.
  12. * @example pickBy({ nested: { a: 1, b: 2, c: 3, d: 4 } }, 'nested', v => v < 3) // => { nested: { a: 1, b: 2 } }
  13. * @see {@link https://lodash.com/docs#pickBy|lodash.pickBy} for more information.
  14. * @see {@link https://lodash.com/docs#identity|lodash.identity} for more information.
  15. * @since 0.1.12
  16. */
  17. const pickBy = convert(_pickBy)
  18. export default pickBy