array/intersection.js

  1. import _intersection from 'lodash/intersection'
  2. import { convert } from 'util/convert'
  3. /**
  4. * Replaces by an array of unique values that are included in th former array and all 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 intersection({ nested: { prop: [1, 2] } }, 'nested.prop', [2, 3]) // => { nested: { prop: [2] } }
  12. * @see {@link https://lodash.com/docs#intersection|lodash.intersection} for more information.
  13. * @since 0.3.0
  14. */
  15. const intersection = convert(_intersection)
  16. export { intersection, intersection as default }