UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

12 lines (9 loc) 376 B
import { flatMapDepth } from './flatMapDepth.mjs'; import { uniq } from '../../array/uniq.mjs'; import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs'; function union(...arrays) { const validArrays = arrays.filter(isArrayLikeObject); const flattened = flatMapDepth(validArrays, v => Array.from(v), 1); return uniq(flattened); } export { union };