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>O.map

Idiomatic type-safety structures for TypeScript.
Go to Latest
method O.map
import { O } from "https://deno.land/x/ahh@v0.9.1/src/option/mod.ts";

Maps the contained Some value with f, otherwise None.

Examples

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

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

Parameters

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