Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KeyIterator

An iterator for the keys in an object.

Notes

This iterator can be used for any JS object.

Hierarchy

  • KeyIterator

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

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

    Parameters

    • source: object

      The object of interest.

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

      The keys to iterate, if known.

    Returns KeyIterator

Properties

Private _index

_index: number = 0

Private _keys

_keys: string[]

Private _source

_source: object

Type declaration

  • [key: string]: any

Methods

clone

  • Create an independent clone of the iterator.

    Returns IIterator<string>

    A new independent clone of the iterator.

iter

  • Get an iterator over the object's values.

    Returns IIterator<string>

    An iterator which yields the object's values.

next

  • next(): string | undefined
  • Get the next value from the iterator.

    Returns string | undefined

    The next value from the iterator, or undefined.

Generated using TypeDoc