array/reverse.js

  1. import _reverse from 'lodash/reverse'
  2. import { convert } from 'util/convert'
  3. /**
  4. * Replaces an array reversing the elements from 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. * @return {Object} Returns the updated object.
  10. * @example reverse({ nested: { prop: [1, 2, 3] } }, 'nested.prop') // => { nested: { prop: [3, 2, 1] } }
  11. * @see {@link https://lodash.com/docs#reverse|lodash.reverse} for more information.
  12. * @since 0.3.0
  13. */
  14. const reverse = convert(_reverse)
  15. export { reverse, reverse as default }