Home Reference Source Repository
import {Maybe} from 'monad-ts/src/maybe.js'
public class | source

Maybe

Extends:

Monad → Maybe

Indirect Implements:

Class Maybe - return given value or produce null if take nothing or get nothing after execution of f(v).

Method Summary

Public Methods
public

bind(f: MF<T, U>, v: T): Pr<U>

Chains the operations on a monadic values.

public

Return nothing (null).

Inherited Summary

From class Monad
public abstract

bind(f: MF<T, U>|D<T>, v: *): Promise<U> | Pr<U> | Error | boolean | void

Binds transformation function and underlying value to the monad.

protected

fail(e: Error | string): Error

Takes Error or string return Error.

protected

just(f: function(v: T), v: T): Pr<U>

Produces result after execution f(v).

Public Methods

public bind(f: MF<T, U>, v: T): Pr<U> source

Chains the operations on a monadic values.

Override:

Monad#bind

Params:

NameTypeAttributeDescription
f MF<T, U>

transformation function for a monad.

v T

underlying value for a monad.

Return:

Pr<U>

transformed by f() value v.

public nothing(): null source

Return nothing (null).

Return:

null