Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Functions

Functions

Export assignment iterNth

  • iterNth(iterator: Iterator, n: number): any
  • Returns the nth iterated value.

    Notes

    • If n exceeds the total number of iterations, the function returns undefined.

    Parameters

    • iterator: Iterator

      input iterator

    • n: number

      iteration number

    Returns any

    nth iterated value

    Example

    var array2iterator = require( `@stdlib/array/to-iterator` );
    
    var it = array2iterator( [ 0, 0, 1, 0, 0 ] );
    
    var v = iterNth( it, 3 );
    // returns 1