import { map } from "https://deno.land/x/ahh@v0.12.1/src/option.ts";
Returns option
with its value mapped via fn
, if it
is a Some
.
Examples
Example 1
Example 1
import { default as O, Option } from "./option.ts";
const num: Option<number> = 8;
const double = O.map(num, (i) => i * 2);
if (O.isSome(double)) {
console.log(num, "doubled is", double);
}