The zipping operation about T
and U
.
The zipped optional of tuple.
import { some, none, zipWith } from "./option.ts";
import { assertEquals } from "../deps.ts";
interface Point {
x: number;
y: number;
}
const newPoint = zipWith((x: number, y: number): Point => ({
x,
y,
}));
assertEquals(newPoint(some(17.5))(some(42.7)), some({ x: 17.5, y: 42.7 }));
assertEquals(newPoint(none())(none()), none());
Generated using TypeDoc
Zips two optionals into one with
fn
.