Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "iter/advance/docs/types/index.d"

Index

Functions

Functions

Export assignment iterAdvance

  • Advances an iterator.

    Notes

    • The function eagerly advances an input iterator n iterations or until the input iterator finishes, whichever comes first.
    throws

    n must be a nonnegative integer

    Parameters

    • iterator: Iterator

      input iterator

    • Optional n: undefined | number

      number of iterations (default: 1e308)

    Returns Iterator

    input iterator

    Example

    var array2iterator = require( `@stdlib/array/to-iterator` );
    
    var it1 = array2iterator( [ 0, 0, 0, 0, 1 ] );
    
    var it2 = iterAdvance( it1, 4 );
    
    var v = it2.next().value;
    // returns 1
    
    var bool = it2.next().done;
    // returns true