array/drop.js

  1. import { drop as _drop } from 'lodash'
  2. import { apply } from 'immutadot/core'
  3. /**
  4. * Replaces an array dropping one or several elements at the start of 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 {number} [n=1] The number of elements to drop.
  10. * @return {Object} Returns the updated object.
  11. * @example drop({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop', 2) // => { nested: { prop: [3, 4] } }
  12. * @see {@link https://lodash.com/docs#drop|lodash.drop} for more information.
  13. * @since 1.0.0
  14. */
  15. const drop = apply(_drop, { arity: 1 })
  16. export { drop }