UNPKG

geninq

Version:

A JavaScript version of the Linq library for Generators

24 lines (22 loc) 578 B
import "./zip"; import "./array"; import { It, ItThrows } from "../test-utils"; It("Combined two sequences automatically", (s) => s.zip([3, 2, 1]).array(), [ [1, 3], [2, 2], [3, 1], ]); It( "Combined two sequences on a selector", (s) => s.zip([3, 2, 1], (a, b) => ({ original: a, incoming: b })).array(), [ { original: 1, incoming: 3 }, { original: 2, incoming: 2 }, { original: 3, incoming: 1 }, ] ); ItThrows( "Errors if the sequences are different lengths", (s) => s.zip([1, 2, 3, 4]).array(), new Error("Sequences are unequal in length") );