UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

15 lines (10 loc) 326 B
import { cloneList } from './_internals/cloneList.js' import { includes } from './includes.js' export function union(x, y){ if (arguments.length === 1) return _y => union(x, _y) const toReturn = cloneList(x) y.forEach(yInstance => { if (!includes(yInstance, x)) toReturn.push(yInstance) }) return toReturn }