Return true
if this is not a Just
instance, or the contained
value is null or undefined. Otherwise, return false
.
Return true
if this is a Just
instance.
Returns true
if this is a Just
instance
Return true
if this is a Nothing
instance.
Returns true
if this is a Nothing
instance
Returns the singleton Nothing
instance.
Returns the singleton Nothing
.
Transforms the value of this Maybe
using an unary function to monads.
if this is a Just
, then return a function that applying the given
function with the value of this Maybe
if this is a Nothing
, then return an identity function of this Maybe
True if this and the other Record have value equality.
Returns the result of applying fn
to the value of this Maybe
if this is
a Just
. Returns Nothing
if this is a Nothing
.
Slightly different from map
is that fn
is expected to return a Maybe
(which could be Nothing
).
the function to apply
Return the result of applying f
to the value of this Maybe
if this is
a Just
. Otherwise, evaluates expression ifEmpty
.
the expression to evaluete if this is a Nothing
the function to apply if this is a Just
Returns the maybe's value if the maybe is a Just
, otherwise return the
default value or
.
the default expression
Returns the maybe's value if the maybe is a Just
, otherwise throw the
given err
which can be either custom error or any object.
Rubbish to throw :)
Returns a Just
containing the result of applying fn
to this Maybe
value
if this Maybe
is a Just
. Otherwise return Nothing
.
the function to apply
Return a Left
containing this maybe's value if this is a Nothing
,
or a Right
containing the given right
if this is a Just
.
the value to return if this is a Nothing
Return a Right
containing this maybe's value if this is a Just
, or
a Left
containing the given left
if this is a Nothing
.
the value to return if this is a Nothing
Returns a Just
instance with the given value.
The value to wrap.
Returns a Just
Constructs a new Maybe
instance with the evaluated value of the given
function.
the function to be evaluated
Check if value
is Just
, and the contained value is defined.
The value to check.
Check if value
is Just
.
The value to check.
Check if value
is subtype of Maybe
, either Just
or Nothing
.
the value to check.
Returns true
if value
is subtype of Maybe
Check if value
is Nothing
.
The value to check.
Constructs a new Maybe
instance.
If the value is either null
or undefined
, the function returns a
Nothing
, otherwise the value is wrapped in a Just(val)
the value to wrap
Returns Nothing
if value
is null or
undefined, else Just
Generated using TypeDoc
Returns the maybe's value.