source: node_modules/es-toolkit/dist/compat/array/union.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 376 bytes
RevLine 
[a762898]1import { flatMapDepth } from './flatMapDepth.mjs';
2import { uniq } from '../../array/uniq.mjs';
3import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
4
5function union(...arrays) {
6 const validArrays = arrays.filter(isArrayLikeObject);
7 const flattened = flatMapDepth(validArrays, v => Array.from(v), 1);
8 return uniq(flattened);
9}
10
11export { union };
Note: See TracBrowser for help on using the repository browser.