array/pop.js

  1. import { applyArrayMethod } from './applyArrayMethod'
  2. /**
  3. * Replaces by an array of elements with last element removed.
  4. * @function
  5. * @memberof array
  6. * @param {Object} object The object to modify.
  7. * @param {Array|string} path The path of the property to set.
  8. * @return {Object} Returns the updated object.
  9. * @example pop({ nested: { prop: [1, 2, 3, 4] } }, 'nested.prop') // => { nested: { prop: [1, 2, 3] } }
  10. * @see {@link https://mdn.io/Array.prototype.pop|Array.prototype.pop} for more information.
  11. * @since 1.0.0
  12. */
  13. const pop = applyArrayMethod('pop', { fixedArity: true })
  14. export { pop }