The source list.
The first element of list if exists.
import { empty, fromString, head, singleton } from "./list.ts";
import * as Option from "./option.ts";
import { assertEquals } from "../deps.ts";
assertEquals(head(empty()), Option.none());
assertEquals(head(fromString("hoge")), Option.some("h"));
const list = singleton(42);
assertEquals(head(list), Option.some(42));
assertEquals(head(list.rest()), Option.none());
Generated using TypeDoc
Gets the first element of the list.