Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

Iterator

Iterator: Iter | IterableIterator

Functions

Export assignment iterPush

  • Returns an iterator which appends additional values to the end of a provided iterator.

    Notes

    • If an environment supports Symbol.iterator and a provided iterator is iterable, the returned iterator is iterable.

    Parameters

    • iterator: Iterator

      input iterator

    • Rest ...items: Array<any>

      items to append

    Returns Iterator

    iterator

    Example

    var array2iterator = require( `@stdlib/array/to-iterator` );
    
    var iter = iterPush( array2iterator( [ 1, 2 ] ), 3, 4 );
    
    var v = iter.next().value;
    // returns 1
    
    v = iter.next().value;
    // returns 2
    
    v = iter.next().value;
    // returns 3
    
    v = iter.next().value;
    // returns 4
    
    var bool = iter.next().done;
    // returns true