Classes
Methods
-
static isJust(x) → {boolean}
-
Checks for
Just
.Parameters:
Name Type Description x
* Returns:
boolean -
static isMaybe(x) → {boolean}
-
Checks for maybe.
Parameters:
Name Type Description x
* .
Returns:
boolean -
static just(x) → {Just}
-
Functional constructor (function that returns an instance) for
Just
- Same asnew Just(...)
(just shorter and can be used as a function).Parameters:
Name Type Description x
Just | * Returns:
Just -
static maybe(replacement, fn, maybeInst) → {*}
-
The maybe function takes a
replacement
value, a function (unary operation), and a Maybe value. If the Maybe value isNothing
, the function returns thereplacement
value. Otherwise, it applies the function to the value contained by theJust
and returns the result.Parameters:
Name Type Description replacement
* fn
function Unary operation.
maybeInst
Nothing | Just | * Maybe instance or non-maybe value.
Returns:
* -
static maybeEqual(a, b) → {boolean}
-
Equality operator for maybes.
Parameters:
Name Type Description a
* Maybe 1.
b
* Maybe 2.
Returns:
boolean -
static nothing() → {Nothing}
-
Returns
Nothing
.Returns:
Nothing -
static toJust(x) → {Just}
-
Ensures
Just
Parameters:
Name Type Description x
Just | * Returns:
Just -
static toMaybe(x) → {Maybe}
-
Creates maybe from value.
Parameters:
Name Type Description x
* -
static unWrapJust(x) → {*}
-
Unwraps just (recursively).
Parameters:
Name Type Description x
* Expected
Just
.Returns:
* -
static unWrapMaybe(x) → {*}
-
Unwraps maybe (recursively).
Parameters:
Name Type Description x
* Expected
Maybe
.Returns:
*