Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

Predicate

Predicate: (i: number) => boolean

Checks whether an iteration number passes a test.

param

iteration number (starting from zero)

returns

boolean indicating whether an iteration number passes a test

Type declaration

    • (i: number): boolean
    • Parameters

      • i: number

      Returns boolean

Functions

Export assignment doUntil

  • doUntil(fcn: Function, predicate: Predicate, thisArg?: any): void
  • Invokes a function until a test condition is true.

    Notes

    • The condition is evaluated after executing the provided function; thus, fcn always executes at least once.

    • When invoked, both the predicate function and the function to invoke are provided a single argument:

      • i: iteration number (starting from zero)

    Parameters

    • fcn: Function

      function to invoke

    • predicate: Predicate

      function which indicates whether to stop invoking a function

    • Optional thisArg: any

      execution context for the invoked function

    Returns void

    Example

    function predicate( i ) {
        return ( i <= 5 );
    }
    
    function beep( i ) {
        console.log( 'beep: %d', i );
    }
    
    doUntil( beep, predicate );