math/subtract.js

  1. import _subtract from 'lodash/subtract'
  2. import { convert } from 'util/convert'
  3. /**
  4. * Replaces by the subtraction of the former number by the given number.
  5. * @function
  6. * @memberof math
  7. * @param {Object} object The object to modify.
  8. * @param {Array|string} path The path of the property to set.
  9. * @param {number} subtrahend The number to subtract.
  10. * @return {Object} Returns the updated object.
  11. * @example subtract({ nested: { prop: 2000 } }, 'nested.prop', 336) // => { nested: { prop: 1664 } }
  12. * @see {@link https://lodash.com/docs#subtract|lodash.subtract} for more information.
  13. * @since 0.3.0
  14. */
  15. const subtract = convert(_subtract)
  16. export { subtract, subtract as default }