Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/ahh/src/option/mod.ts>map

Opinionated idiomatic type-safety functions.
Go to Latest
function map
import { map } from "https://deno.land/x/ahh@v0.11.0/src/option/mod.ts";

Calls f with opt, and returns the result.

Examples

Example 1

import { default as 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