array/dropRightWhile.js

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