@tsdotnet/promises - v2.0.11
    Preparing search index...

    Class ArrayPromise<T>

    By providing an ArrayPromise we expose useful methods/shortcuts for dealing with array results.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _error?: unknown
    _resolvedCalled: undefined | boolean
    _result?: T[]
    _state: State

    Accessors

    • get error(): unknown

      Returns unknown

    • get isFulfilled(): boolean

      Returns boolean

    • get isPending(): boolean

      Returns boolean

    • get isRejected(): boolean

      Returns boolean

    • get isSettled(): boolean

      Returns boolean

    • get result(): undefined | T

      Returns undefined | T

    Methods

    • Will yield for a number of milliseconds from after this promise resolves. If the promise is already resolved, the delay will start from now.

      Parameters

      • milliseconds: number = 0

      Returns PromiseBase<T[]>

      A promise that yields to the current execution and executes after a delay.

    • Will yield for a number of milliseconds from the time called before continuing.

      Parameters

      • milliseconds: number = 0

      Returns PromiseBase<T[]>

      A promise that yields to the current execution and executes after a delay.

    • .done is provided as a non-standard means that maps to similar functionality in other promise libraries. As stated by promisejs.org: 'then' is to 'done' as 'map' is to 'forEach'.

      Parameters

      • onFulfilled: undefined | null | Fulfill<T[], unknown>
      • OptionalonRejected: null | Reject<unknown>

      Returns void

    • .doneNow is provided as a non-standard means that synchronously resolves as the end of a promise chain. As stated by promisejs.org: 'then' is to 'done' as 'map' is to 'forEach'. It is the underlying method by which propagation occurs.

      Parameters

      • onFulfilled: undefined | null | Fulfill<T[], unknown>
      • OptionalonRejected: null | Reject<unknown>

      Returns void

    • Shortcut to for handling either resolve or reject. Returns the current promise instead. You may not need an additional promise result, and this will not create a new one.

      Parameters

      • fin: Closure
      • Optionalsynchronous: boolean

      Returns this

    • Simplifies the use of a map function on an array of results when the source is assured to be an array.

      Type Parameters

      • U

      Parameters

      • transform: (value: T) => U

      Returns ArrayPromise<U>

    • Simplifies the use of a reduce function on an array of results when the source is assured to be an array.

      Parameters

      • reduction: (previousValue: T, currentValue: T, i?: number, array?: T[]) => T
      • OptionalinitialValue: T

      Returns PromiseBase<T>

    • Simplifies the use of a reduce function on an array of results when the source is assured to be an array.

      Type Parameters

      • U

      Parameters

      • reduction: (previousValue: U, currentValue: T, i?: number, array?: T[]) => U
      • initialValue: U

      Returns PromiseBase<U>

    • Parameters

      • error: unknown
      • throwIfSettled: boolean = false

      Returns void

    • Parameters

      • Optionalresult: T[] | PromiseLike<T[]>
      • throwIfSettled: boolean = false

      Returns void

    • Same as 'thenSynchronous' but does not return the result. Returns the current promise instead. You may not need an additional promise result, and this will not create a new one.

      Parameters

      • onFulfilled: undefined | null | Fulfill<T[], unknown>
      • OptionalonRejected: null | Reject<unknown>

      Returns this