Skip to main content
Module

x/ahh/mod.ts>O.map

Idiomatic type-safety functions.
Go to Latest
method O.map
Re-export
import { O } from "https://deno.land/x/ahh@v0.10.1/mod.ts";

Calls f with opt, and returns the result.

Examples

import { O, None } from "./mod.ts";

console.log(O.map(1, (i) => i + 1)); // 2
console.log(O.map(None, (i: number) => i + 1)); // undefined

Parameters

opt: Option<T>
f: (_: T) => U