UNPKG

geninq

Version:

A JavaScript version of the Linq library for Generators

28 lines (25 loc) 561 B
import "./union"; import "./array"; import { It } from "../test-utils"; It( "Only includes an element once", (s) => s.union([1, 2, 4]).array(), [1, 2, 3, 4] ); It( "Only includes an element once from a single sequence", (s) => s.union([1, 2, 4, 4]).array(), [1, 2, 3, 4] ); It( "Uses a custom comparitor", (s) => s .union( [{ test: 1 }, { test: 2 }, { test: 4 }], (a, b) => a.test === b.test ) .array(), [{ test: 1 }, { test: 2 }, { test: 3 }, { test: 4 }], [{ test: 1 }, { test: 2 }, { test: 3 }] );