Create a Maybe
from any value.
To specify that the result should be interpreted as a specific type, you may
invoke Maybe.of
with an explicit type parameter:
const foo = Maybe.of<string>(null);
This is usually only important in two cases:
Nothing
from a known null
or
undefined value which is untyped.The value to wrap in a Maybe
. If it is undefined
or null
,
the result will be Nothing
; otherwise it will be the type of
the value passed.
Create a Maybe
from any value.
To specify that the result should be interpreted as a specific type, you may
invoke Maybe.of
with an explicit type parameter:
const foo = Maybe.of<string>(null);
This is usually only important in two cases:
Nothing
from a known null
or
undefined value which is untyped.The type of the item contained in the Maybe
.
The value to wrap in a Maybe
. If it is undefined
or null
,
the result will be Nothing
; otherwise it will be the type of
the value passed.
Create a Maybe
from any value.
To specify that the result should be interpreted as a specific type, you may
invoke Maybe.of
with an explicit type parameter:
const foo = Maybe.of<string>(null);
This is usually only important in two cases:
Nothing
from a known null
or
undefined value which is untyped.The value to wrap in a Maybe
. If it is undefined
or null
,
the result will be Nothing
; otherwise it will be the type of
the value passed.
Create a Maybe
from any value.
To specify that the result should be interpreted as a specific type, you may
invoke Maybe.of
with an explicit type parameter:
const foo = Maybe.of<string>(null);
This is usually only important in two cases:
Nothing
from a known null
or
undefined value which is untyped.The value to wrap in a Maybe
. If it is undefined
or null
,
the result will be Nothing
; otherwise it will be the type of
the value passed.
Create a
Maybe
from any value.To specify that the result should be interpreted as a specific type, you may invoke
Maybe.of
with an explicit type parameter:This is usually only important in two cases:
Nothing
from a knownnull
or undefined value which is untyped.Template: T
The type of the item contained in the
Maybe
.Param: value
The value to wrap in a
Maybe
. If it isundefined
ornull
, the result will beNothing
; otherwise it will be the type of the value passed.