array/difference.js

  1. import _difference from 'lodash/difference'
  2. import { convert } from 'util/convert'
  3. /**
  4. * Replaces an array removing values in the other given arrays 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. * @param {...Array} values The arrays of values to exclude.
  10. * @return {Object} Returns the updated object.
  11. * @example difference({ nested: { prop: [1, 2] } }, 'nested.prop', [2, 3]) // => { nested: { prop: [1] } }
  12. * @see {@link https://lodash.com/docs#difference|lodash.difference} for more information.
  13. * @since 0.2.0
  14. */
  15. const difference = convert(_difference)
  16. export { difference, difference as default }