Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ItemIterator<T>

An iterator for the items in an object.

Notes

This iterator can be used for any JS object.

Type parameters

  • T

Hierarchy

  • ItemIterator

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • new ItemIterator(source: object, keys?: string[]): ItemIterator
  • Construct a new item iterator.

    Parameters

    • source: object

      The object of interest.

      • [key: string]: T
    • Default value keys: string[] = Object.keys(source)

      The keys to iterate, if known.

    Returns ItemIterator

Properties

Private _index

_index: number = 0

Private _keys

_keys: string[]

Private _source

_source: object

Type declaration

  • [key: string]: T

Methods

clone

  • Create an independent clone of the iterator.

    Returns IIterator<[string, T]>

    A new independent clone of the iterator.

iter

  • Get an iterator over the object's values.

    Returns IIterator<[string, T]>

    An iterator which yields the object's values.

next

  • next(): [string, T] | undefined
  • Get the next value from the iterator.

    Returns [string, T] | undefined

    The next value from the iterator, or undefined.

Generated using TypeDoc