import { Option } from "https://deno.land/x/optionals@v3.0.0/mod.ts";
A Rust-like Option class.
Note: Please use either Some
or None
to construct an Option.
Constructors
new
Option(input: T | none)A constructor for an Option.
Note: Please use either Some
or None
to construct Options.
Properties
private
val: T | noneMethods
Returns the contained Some value, consuming the Option. Throws an Error with a given message if the contained value is None.
Maps an Option to Option by applying a function to a contained Some value, leaving None values untouched.
Returns contained value for use in matching.
Note: Please only use this to match against in if
or swtich
statments.