Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/until-each/docs/types/index.d"

Index

Type aliases

Binary

Binary<T, U>: (this: U, value: T, index: number) => void

Function invoked for each collection element until test condition is true.

param

collection value

param

collection index

Type parameters

  • T

  • U

Type declaration

    • (this: U, value: T, index: number): void
    • Parameters

      • this: U
      • value: T
      • index: number

      Returns void

BinaryPredicate

BinaryPredicate<T>: (value: T, index: number) => boolean

Checks whether an element in a collection passes a test.

param

collection value

param

collection index

returns

boolean indicating whether an element in a collection passes a test

Type parameters

  • T

Type declaration

    • (value: T, index: number): boolean
    • Parameters

      • value: T
      • index: number

      Returns boolean

Callback

Callback<T, U>: Nullary<U> | Unary<T, U> | Binary<T, U> | Ternary<T, U>

Function invoked for each collection element until test condition is true.

param

collection value

param

collection index

param

input collection

Type parameters

  • T

  • U

Nullary

Nullary<U>: (this: U) => void

Function invoked for each collection element until test condition is true.

Type parameters

  • U

Type declaration

    • (this: U): void
    • Parameters

      • this: U

      Returns void

NullaryPredicate

NullaryPredicate: () => boolean

Checks whether an element in a collection passes a test.

returns

boolean indicating whether an element in a collection passes a test

Type declaration

    • (): boolean
    • Returns boolean

Predicate

Checks whether an element in a collection passes a test.

param

collection value

param

collection index

param

input collection

returns

boolean indicating whether an element in a collection passes a test

Type parameters

  • T

Ternary

Ternary<T, U>: (this: U, value: T, index: number, collection: Collection<T>) => void

Function invoked for each collection element until test condition is true.

param

collection value

param

collection index

param

input collection

Type parameters

  • T

  • U

Type declaration

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

      • this: U
      • value: T
      • index: number
      • collection: Collection<T>

      Returns void

TernaryPredicate

TernaryPredicate<T>: (value: T, index: number, collection: Collection<T>) => boolean

Checks whether an element in a collection passes a test.

param

collection value

param

collection index

param

input collection

returns

boolean indicating whether an element in a collection passes a test

Type parameters

  • T

Type declaration

    • (value: T, index: number, collection: Collection<T>): boolean
    • Parameters

      • value: T
      • index: number
      • collection: Collection<T>

      Returns boolean

Unary

Unary<T, U>: (this: U, value: T) => void

Function invoked for each collection element until test condition is true.

param

collection value

Type parameters

  • T

  • U

Type declaration

    • (this: U, value: T): void
    • Parameters

      • this: U
      • value: T

      Returns void

UnaryPredicate

UnaryPredicate<T>: (value: T) => boolean

Checks whether an element in a collection passes a test.

param

collection value

returns

boolean indicating whether an element in a collection passes a test

Type parameters

  • T

Type declaration

    • (value: T): boolean
    • Parameters

      • value: T

      Returns boolean

Functions

Export assignment untilEach

  • Until a test condition is true, invokes a function once for each element in a collection.

    Notes

    • When invoked, both the predicate function and the function to apply are provided three arguments:

      • value: collection value
      • index: collection index
      • collection: the input collection

    Type parameters

    • T

    • U

    Parameters

    • collection: Collection<T>

      input collection

    • predicate: Predicate<T>

      function which indicates whether to stop iterating over a collection

    • fcn: Callback<T, U>

      function to invoke

    • Optional thisArg: ThisParameterType<Callback<T, U>>

      execution context for the applied function

    Returns Collection < T >

    input collection

    Example

    function predicate( v, key, collection ) {
        return ( v !== v );
    }
    
    function log( v, key, collection ) {
        console.log( '%s: %d', key, v );
    }
    
    var arr = [ 1, 2, 3, 4, NaN, 5 ];
    
    untilEach( arr, predicate, log );