array/dropWhile.js

  1. import { dropWhile as _dropWhile } from 'lodash'
  2. import { convert } from 'immutadot'
  3. /**
  4. * Replaces an array excluding elements dropped from the beginning. Elements are dropped until <code>predicate</code> returns falsey.
  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 dropWhile({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', v => v < 3) // => { nested: { prop: [3, 4] } }
  12. * @see {@link https://lodash.com/docs#dropWhile|lodash.dropWhile} for more information.
  13. * @since 1.0.0
  14. */
  15. const dropWhile = convert(_dropWhile)
  16. export { dropWhile }