geninq
Version:
A JavaScript version of the Linq library for Generators
15 lines (13 loc) • 368 B
text/typescript
import { It, ItThrows } from "../test-utils";
import "./at";
It("Gets an element at specific point in the sequence", (s) => s.at(2), 3);
It(
"Returns undefined if the element does not exist",
(s) => s.at(4, "or-default"),
undefined
);
ItThrows(
"Throws for element that does not exist",
(s) => s.at(4),
new Error("Index 4 does not exist in sequence.")
);