import { type Option } from "https://deno.land/x/funky@v0.3.2/mod.ts";
Represents a runtime-safe value which is optional. An optional value is a value which might or might not be
present. The Option
type allows you to write safe code around that value, without unexpected runtime exceptions.
Methods
If the option is an OptionSome
instance invokes the @handler
function, providing the wrapped value as the
argument and returns the result as an Option
. Otherwise, returns an OptionNone
instance.
If the option is an OptionSome
instance invokes the @handler.some
function, providing the wrapped value as the
argument and returns the result.
Otherwise, invokes the @handler.none
function and returns the result.
If the option is an OptionSome
instance invokes the @handler
function, providing the wrapped value as the
argument.
If the option is an OptionSome
instance invokes the @handler
function. Otherwise, the @handler
function is
not invoked.
If the option is an OptionNone
instance returns the specified @other
option. Otherwise, returns the original
OptionSome
instance.
If the option is an OptionSome
instance returns the specfied @other
option. Otherwise, returns an OptionNone
instance.
If the option is an OptionSome
instance invokes the @handler
function, providing the wrapped value as the
argument and returns the result. Otherwise, returns an OptionNone
instance.
If the option is an OptionSome
instance returns the wrapped value. Otherwise, throws an Error
.