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

AsyncFlow

Extends:

Monad → AsyncFlow

Indirect Implements:

Class AsyncFlow - for composing monads in an async flow (pipe), based on Promise.

Constructor Summary

Public Constructor
public

constructor(initV: any, encapsulate: boolean)

Creates an instance of class AsyncFlow.

Member Summary

Public Members
public

The instance of ErrorM.

public

flow: any

Keep initial flow (pipe) value.

public

The instance of Maybe.

Method Summary

Public Methods
public

bind(f: function(v: T)): Promise<T>

Binds initial value to the transformation function.

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 Constructors

public constructor(initV: any, encapsulate: boolean) source

Creates an instance of class AsyncFlow.

Params:

NameTypeAttributeDescription
initV any
  • optional
  • default: 0

initV - initial value of new flow (pipe).

encapsulate boolean
  • optional
  • default: true

encapsulate - flag, if true then the init value will be cloned.

Public Members

public err: ErrorM source

The instance of ErrorM.

public flow: any source

Keep initial flow (pipe) value.

public maybe: Maybe source

The instance of Maybe.

Public Methods

public bind(f: function(v: T)): Promise<T> source

Binds initial value to the transformation function.

Override:

Monad#bind

Params:

NameTypeAttributeDescription
f function(v: T)

transformation function.

Return:

Promise<T>