Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/async/count-by/docs/types/index.d"

Index

Type aliases

Binary

Binary: (error: Error | null, result: Results) => void

Callback invoked either upon processing all collection elements or upon encountering an error.

param

encountered error or null

param

counts

Type declaration

    • (error: Error | null, result: Results): void
    • Parameters

      • error: Error | null
      • result: Results

      Returns void

BinaryIndicator

BinaryIndicator<T, V>: (this: V, value: T, next: Next) => void

Returns the group to which a collection element belongs.

param

collection value

param

a callback to be invoked after processing a collection value

Type parameters

  • T

  • V

Type declaration

    • (this: V, value: T, next: Next): void
    • Parameters

      • this: V
      • value: T
      • next: Next

      Returns void

BinaryNext

BinaryNext: (error: Error | null, group: string | Symbol | number) => void

Callback function to invoke once the predicate function has finished processing a collection value.

param

encountered error or null

param

value group

Type declaration

    • (error: Error | null, group: string | Symbol | number): void
    • Parameters

      • error: Error | null
      • group: string | Symbol | number

      Returns void

Callback

Callback: Nullary | Unary | Binary

Callback invoked either upon processing all collection elements or upon encountering an error.

param

encountered error or null

param

counts

FactoryFunction

FactoryFunction<T>: (collection: Collection<T>, done: Callback) => void

Invokes an indicator function for each element in a collection.

param

input collection

param

function to invoke upon completion

Type parameters

  • T

Type declaration

Indicator

Indicator<T, V>: BinaryIndicator<T, V> | TernaryIndicator<T, V> | QuaternaryIndicator<T, V>

Returns the group to which a collection element belongs.

param

collection value

param

collection index

param

input collection

param

a callback to be invoked after processing a collection value

Type parameters

  • T

  • V

Next

Callback function to invoke once the predicate function has finished processing a collection value.

param

encountered error or null

param

value group

Nullary

Nullary: () => void

Callback invoked either upon processing all collection elements or upon encountering an error.

Type declaration

    • (): void
    • Returns void

NullaryNext

NullaryNext: () => void

Callback function to invoke once the predicate function has finished processing a collection value.

Type declaration

    • (): void
    • Returns void

QuaternaryIndicator

QuaternaryIndicator<T, V>: (this: V, value: T, index: number, collection: Collection<T>, next: Next) => void

Returns the group to which a collection element belongs.

param

collection value

param

collection index

param

input collection

param

a callback to be invoked after processing a collection value

Type parameters

  • T

  • V

Type declaration

    • (this: V, value: T, index: number, collection: Collection<T>, next: Next): void
    • Parameters

      Returns void

TernaryIndicator

TernaryIndicator<T, V>: (this: V, value: T, index: number, next: Next) => void

Returns the group to which a collection element belongs.

param

collection value

param

collection index

param

a callback to be invoked after processing a collection value

Type parameters

  • T

  • V

Type declaration

    • (this: V, value: T, index: number, next: Next): void
    • Parameters

      • this: V
      • value: T
      • index: number
      • next: Next

      Returns void

Unary

Unary: (error: Error | null) => void

Callback invoked either upon processing all collection elements or upon encountering an error.

param

encountered error or null

Type declaration

    • (error: Error | null): void
    • Parameters

      • error: Error | null

      Returns void

UnaryNext

UnaryNext: (error: Error | null) => void

Callback function to invoke once the predicate function has finished processing a collection value.

param

encountered error or null

Type declaration

    • (error: Error | null): void
    • Parameters

      • error: Error | null

      Returns void

Variables

Export assignment countByAsync

countByAsync: CountByAsync

Groups values according to an indicator function and returns group counts.

Notes

  • This function does not guarantee that execution is asynchronous. To do so, wrap the done callback in a function which either executes at the end of the current stack (e.g., nextTick) or during a subsequent turn of the event loop (e.g., setImmediate, setTimeout).
param

input collection

param

function options

param

execution context

param

maximum number of pending invocations at any one time

param

boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)

param

indicator function specifying which group an element in the input collection belongs to

param

function to invoke upon completion

throws

must provide valid options