_Wrapper

itbl. _Wrapper

Base class with prototype containing chained itbl methods. This class is returned by itbl() and itbl.wrap().

Constructor

new _Wrapper(optionsopt)

Create a new Wrapped iterable/iterator.

Parameters:
Name Type Attributes Default Description
options Object <optional>
{}
Properties
Name Type Attributes Description
next function <optional>

Method which gets next value of iterator.

throw function <optional>

Method which resumes the execution of a generator by throwing an error into it and returns an object with two properties done and value.

return function <optional>

Method which returns given value and finishes the iterator.

[Symbol.iterator] function <optional>

Method which gets iterator to an iterable.

Since:
  • 0.1.0
Implements:
  • Iterable
Source:

Methods

[Symbol.iterator]() → {itbl._Wrapper}

Get an iterator to the wrapped iterable.

By default returns its self but will be overwritten if a [Symbol.iterator] method is passed to the constructor.

Since:
  • 2.0.0
Source:
Throws:

Throws if the wrapped value is an iterator or an iterable whose [Symbol.iterator] method throws.

Returns:

Returns a wrapped iterator.

Type
itbl._Wrapper

next() → {Step}

Get the next value of this iterator.

This method is only defined if the wrapped value is an iterator.

Since:
  • 2.0.0
Source:
Throws:

Throws if the wrapped iterator's next method throws.

Returns:

Returns the next iterator value.

Type
Step

return(value) → {Step}

Returns given value and finishes the iterator.

This method is only defined if the wrapped value is defines a return method

Parameters:
Name Type Description
value *

The value to return

Since:
  • 2.0.0
Source:
Throws:

Throws if the wrapped iterator's return method throws.

Returns:

Returns a Step with a value of value.

Type
Step

throw(exception) → {Step}

The throw() method resumes the execution of a generator by throwing an error into it and returns an object with two properties done and value.

This method is only defined if the wrapped value is an iterator

Parameters:
Name Type Description
exception *

The exception to throw. For debugging purposes, it is useful to make it an instanceof Error.

Since:
  • 2.0.0
Source:
Throws:

Throws if the wrapped iterator's return method throws, for a generator function this happens if the yield expression is not contained within a try-catch block.

Returns:

Returns the next iterator value.

Type
Step