@nevware21/ts-utils
    Preparing search index...

    Function isIterator

    • Checks if the type of value looks like an iterator instance (contains a next function).

      Type Parameters

      • T = any

        Identifies the return type of the iterator defaults to any

      Parameters

      • value: any

        The value to be checked

      Returns value is Iterator<T, any, undefined>

      True if the value is an Iterator, otherwise false

      0.4.0

      isIterator(null);        // false
      isIterator(undefined); // false
      isIterator("null"); // false (Strings are iterable but not iterators)
      isIterator([]); // false (Arrays are iterable but not iterators)
      isIterator({
      next: function() { return true }
      }); // true, iterators must contain a "next" function