array/xor.js

  1. import { xor as _xor } from 'lodash'
  2. import { apply } from 'immutadot/core'
  3. /**
  4. * Replaces an array by the symmetric difference of the former array and the given arrays.
  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} arrays The arrays to inspect.
  10. * @return {Object} Returns the updated object.
  11. * @example xor({ nested: { prop: [1, 2] } }, 'nested.prop', [2, 3]) // => { nested: { prop: [1, 3] } }
  12. * @see {@link https://lodash.com/docs#xor|lodash.xor} for more information.
  13. * @since 1.0.0
  14. */
  15. const xor = apply(_xor, { arity: 2 })
  16. export { xor }