Home

# Library goog.iter

Function Summary
| `chain((goog.iter.Iterator|null|undefined) var_args) ⇒ !goog.iter.Iterator` Takes zero or more iterators and returns one iterator that will iterate over them in the order chained.
| `cycle(!goog.iter.Iterable iterable) ⇒ !goog.iter.Iterator` Create an iterator to cycle over the iterable's elements indefinitely. For example, ([1, 2, 3]) would return : 1, 2, 3, 1, 2, 3, ...
| `dropWhile(?goog.iter.Iterable iterable, ?Function f, ?Object= opt_obj) ⇒ !goog.iter.Iterator` Builds a new iterator that iterates over the original, but skips elements as long as a supplied function returns true.
| `equals(?goog.iter.Iterable iterable1, ?goog.iter.Iterable iterable2) ⇒ boolean` Iterates over 2 iterators and returns true if they contain the same sequence of elements and have the same length.
| `every(?goog.iter.Iterable iterable, ?Function f, ?Object= opt_obj) ⇒ boolean` Goes through the values in the iterator. Calls f for each these and if any of them returns false this returns false (without checking the rest). If all return true this will return true.
| `filter(?goog.iter.Iterable iterable, ?Function f, ?Object= opt_obj) ⇒ !goog.iter.Iterator` Calls a function for every element in the iterator, and if the function returns true adds the element to a new iterator.
| `forEach(?goog.iter.Iterable iterable, ?Function f, ?Object= opt_obj)` Calls a function for each element in the iterator with the element of the iterator passed as argument.
| `join(?goog.iter.Iterable iterable, string deliminator) ⇒ string` Joins the values in a iterator with a delimiter.
| `map(?goog.iter.Iterable iterable, ?Function f, ?Object= opt_obj) ⇒ !goog.iter.Iterator` For every element in the iterator call a function and return a new iterator with that value.
| `nextOrValue(?goog.iter.Iterable iterable, <Any Type> defaultValue) ⇒ <Any Type>` Advances the iterator to the next position, returning the given default value instead of throwing an exception if the iterator has no more entries.
| `product((goog.array.ArrayLike|undefined) var_args) ⇒ !goog.iter.Iterator` Cartesian product of zero or more sets. Gives an iterator that gives every combination of one element chosen from each set. For example, ([1, 2], [3, 4]) gives ([1, 3], [1, 4], [2, 3], [2, 4]).

`range(number startOrStop, number= opt_stop, number= opt_step) ⇒ !goog.iter.Iterator`

Creates a new iterator that returns the values in a range. This function can take 1, 2 or 3 arguments:

    range(5) same as range(0, 5, 1)
    range(2, 5) same as range(2, 5, 1)

| `reduce(?goog.iter.Iterable iterable, ?Function f, <Any Type> val, ?Object= opt_obj) ⇒ <Any Type>` Passes every element of an iterator into a function and accumulates the result.
| `some(?goog.iter.Iterable iterable, ?Function f, ?Object= opt_obj) ⇒ boolean` Goes through the values in the iterator. Calls f for each these and if any of them returns true, this returns true (without checking the rest). If all return false this will return false.
| `takeWhile(?goog.iter.Iterable iterable, ?Function f, ?Object= opt_obj) ⇒ !goog.iter.Iterator` Builds a new iterator that iterates over the original, but only as long as a supplied function returns true.
| `toArray(?goog.iter.Iterable iterable) ⇒ !Array` Converts the iterator to an array
| `toIterator(?goog.iter.Iterable iterable) ⇒ !goog.iter.Iterator` Returns an iterator that knows how to iterate over the values in the object.