Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/optio/operators/transform.ts

Minimum option type port of Rust
Latest
import * as optio from "https://deno.land/x/optio@1.0.0/operators/transform.ts";

Functions

Returns None if the option is None, otherwise calls predicate with the wrapped value and returns:

  • Some if predicate returns true.
  • None if predicate returns false.

Converts from Option<Option<T>> to Option<T>.

Maps an Option<T> to Option<U> by applying a function to a contained value(if Some) or returns None(if None).

Returns the provided default value (if None), or applies a function to the contained value (if Some).

Computes a default function result (if None), or applies a different function to the contained value (if Some).

Zips option with another Option.