UNPKG

geninq

Version:

A JavaScript version of the Linq library for Generators

29 lines (27 loc) 642 B
import { It } from "../test-utils"; import "./distinct"; import "./array"; It( "Will distinct on numbers", (g) => g.distinct().array(), [1, 2, 3], [1, 1, 2, 2, 3, 3] ); It( "Will distinct on strings", (g) => g.distinct().array(), ["1", "2", "3"], ["1", "1", "2", "2", "3", "3"] ); It( "Will distinct on booleans", (g) => g.distinct().array(), [true, false], [true, true, false, false] ); It( "Will distinct on custom comparitor", (g) => g.distinct((a, b) => a.test === b.test).array(), [{ test: 1 }, { test: 2 }, { test: 3 }], [{ test: 1 }, { test: 1 }, { test: 2 }, { test: 2 }, { test: 3 }, { test: 3 }] );