selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
78 lines • 23.9 kB
HTML
<meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.iter</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace goog.iter</h1><a class="source" href="source/lib/goog/iter/iter.js.src.html#l21">code »</a></header><section></section><section><h2>Classes</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a><dd>Class/interface for iterators.</dl></table></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="typedefs"><h2>Type Definitions</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l36">code »</a><a class="member" name="goog.iter.Iterable">goog.iter.Iterable</a> : <code class="type">(<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a>|{length: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}|{__iterator__: ?})</code></div><div>No description.</div></summary></details></div></div></section><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l392">code »</a><span class="member"><a name="goog.iter.chain">goog.iter.chain</a> <span class="args">( var_args )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Takes zero or more iterators and returns one iterator that will iterate over
them in the order chained.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code><dd>Any number of iterator objects.</dl><tr><th>Returns<tr><td><dl>Returns a new iterator that will iterate over
all the given iterators' contents.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l656">code »</a><span class="member"><a name="goog.iter.cycle">goog.iter.cycle</a> <span class="args">( iterable )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Create an iterator to cycle over the iterable's elements indefinitely.
For example, ([1, 2, 3]) would return : 1, 2, 3, 1, 2, 3, ...</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type">!<a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterable object.</dl><tr><th>Returns<tr><td><dl>An iterator that iterates indefinitely over
the values in <code >iterable</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l439">code »</a><code class="type"><T></code> <span class="member"><a name="goog.iter.dropWhile">goog.iter.dropWhile</a> <span class="args">( iterable, f, opt_obj )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Builds a new iterator that iterates over the original, but skips elements as
long as a supplied function returns true.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator object.<dt>f: <code class="type">function(this: T, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>, ?): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to call for
every value. This function
takes 3 arguments (the value, undefined, and the iterator) and should
return a boolean.<dt>opt_obj: <code class="type">T=</code><dd>The object to be used as the value of 'this' within
<code >f</code>.</dl><tr><th>Returns<tr><td><dl>A new iterator that drops elements from the
original iterator as long as <code >f</code> is true.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l520">code »</a><span class="member"><a name="goog.iter.equals">goog.iter.equals</a> <span class="args">( iterable1, iterable2 )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Iterates over 2 iterators and returns true if they contain the same sequence
of elements and have the same length.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable1: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The first iterable object.<dt>iterable2: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The second iterable object.</dl><tr><th>Returns<tr><td><dl>true if the iterators contain the same sequence of
elements and have the same length.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l367">code »</a><code class="type"><T></code> <span class="member"><a name="goog.iter.every">goog.iter.every</a> <span class="args">( iterable, f, opt_obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator object.<dt>f: <code class="type">function(this: T, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>, ?): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to call for
every value. This function
takes 3 arguments (the value, undefined, and the iterator) and should
return a boolean.<dt>opt_obj: <code class="type">T=</code><dd>The object to be used as the value of 'this' within
<code >f</code>.</dl><tr><th>Returns<tr><td><dl>true if every value passes the test.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l197">code »</a><code class="type"><T></code> <span class="member"><a name="goog.iter.filter">goog.iter.filter</a> <span class="args">( iterable, f, opt_obj )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Calls a function for every element in the iterator, and if the function
returns true adds the element to a new iterator.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator to iterate over.<dt>f: <code class="type">function(this: T, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>, ?): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to call for
every element. This function
takes 3 arguments (the element, undefined, and the iterator) and should
return a boolean. If the return value is true the element will be
included in the returned iteror. If it is false the element is not
included.<dt>opt_obj: <code class="type">T=</code><dd>The object to be used as the value of 'this' within
<code >f</code>.</dl><tr><th>Returns<tr><td><dl>A new iterator in which only elements that
passed the test are present.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l151">code »</a><code class="type"><T></code> <span class="member"><a name="goog.iter.forEach">goog.iter.forEach</a> <span class="args">( iterable, f, opt_obj )</span></span></div><p>Calls a function for each element in the iterator with the element of the
iterator passed as argument.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator to iterate
over. If the iterable is an object <code >toIterator</code> will be called on
it.<dt>f: <code class="type">function(this: T, ?, ?, ?): ?</code><dd>The function to call for every
element. This function
takes 3 arguments (the element, undefined, and the iterator) and the
return value is irrelevant. The reason for passing undefined as the
second argument is so that the same function can be used in
goog.array#forEach as well as others.<dt>opt_obj: <code class="type">T=</code><dd>The object to be used as the value of 'this' within
<code >f</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l261">code »</a><span class="member"><a name="goog.iter.join">goog.iter.join</a> <span class="args">( iterable, deliminator )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Joins the values in a iterator with a delimiter.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator to get the values from.<dt>deliminator: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The text to put between the values.</dl><tr><th>Returns<tr><td><dl>The joined value string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l281">code »</a><code class="type"><T></code> <span class="member"><a name="goog.iter.map">goog.iter.map</a> <span class="args">( iterable, f, opt_obj )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>For every element in the iterator call a function and return a new iterator
with that value.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator to iterate over.<dt>f: <code class="type">function(this: T, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>, ?): ?</code><dd>The function to call for every
element. This function
takes 3 arguments (the element, undefined, and the iterator) and should
return a new value.<dt>opt_obj: <code class="type">T=</code><dd>The object to be used as the value of 'this' within
<code >f</code>.</dl><tr><th>Returns<tr><td><dl>A new iterator that returns the results of
applying the function to each element in the original iterator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l573">code »</a><span class="member"><a name="goog.iter.nextOrValue">goog.iter.nextOrValue</a> <span class="args">( iterable, defaultValue )</span> ⇒ <code class="type">*</code></span></div><p>Advances the iterator to the next position, returning the given default value
instead of throwing an exception if the iterator has no more entries.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterable object.<dt>defaultValue: <code class="type">*</code><dd>The value to return if the iterator is empty.</dl><tr><th>Returns<tr><td><dl>The next item in the iteration, or defaultValue if the iterator
was empty.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l594">code »</a><span class="member"><a name="goog.iter.product">goog.iter.product</a> <span class="args">( var_args )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>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]).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...!<a href="namespace_goog_array.html#goog.array.ArrayLike">goog.array.ArrayLike</a></code><dd>Zero or more sets, as arrays.</dl><tr><th>Returns<tr><td><dl>An iterator that gives each n-tuple (as an
array).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l230">code »</a><span class="member"><a name="goog.iter.range">goog.iter.range</a> <span class="args">( startOrStop, opt_stop, opt_step )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Creates a new iterator that returns the values in a range. This function
can take 1, 2 or 3 arguments:
<pre>
range(5) same as range(0, 5, 1)
range(2, 5) same as range(2, 5, 1)
</pre></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>startOrStop: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The stop value if only one argument is provided.
The start value if 2 or more arguments are provided. If only one
argument is used the start value is 0.<dt>opt_stop: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>The stop value. If left out then the first
argument is used as the stop value.<dt>opt_step: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>The number to increment with between each call to
next. This can be negative.</dl><tr><th>Returns<tr><td><dl>A new iterator that returns the values in the
range.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l310">code »</a><code class="type"><T, V></code> <span class="member"><a name="goog.iter.reduce">goog.iter.reduce</a> <span class="args">( iterable, f, val, opt_obj )</span> ⇒ <code class="type">V</code></span></div><p>Passes every element of an iterator into a function and accumulates the
result.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator to iterate over.<dt>f: <code class="type">function(this: T, V, ?): V</code><dd>The function to call for every
element. This function takes 2 arguments (the function's previous result
or the initial value, and the value of the current element).
function(previousValue, currentElement) : newValue.<dt>val: <code class="type">V</code><dd>The initial value to pass into the function on the first call.<dt>opt_obj: <code class="type">T=</code><dd>The object to be used as the value of 'this'
within f.</dl><tr><th>Returns<tr><td><dl>Result of evaluating f repeatedly across the values of
the iterator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l334">code »</a><code class="type"><T></code> <span class="member"><a name="goog.iter.some">goog.iter.some</a> <span class="args">( iterable, f, opt_obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>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.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator object.<dt>f: <code class="type">function(this: T, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>, ?): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to call for
every value. This function
takes 3 arguments (the value, undefined, and the iterator) and should
return a boolean.<dt>opt_obj: <code class="type">T=</code><dd>The object to be used as the value of 'this' within
<code >f</code>.</dl><tr><th>Returns<tr><td><dl>true if any value passes the test.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l471">code »</a><code class="type"><T></code> <span class="member"><a name="goog.iter.takeWhile">goog.iter.takeWhile</a> <span class="args">( iterable, f, opt_obj )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Builds a new iterator that iterates over the original, but only as long as a
supplied function returns true.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator object.<dt>f: <code class="type">function(this: T, ?, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>, ?): <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd>The function to call for
every value. This function
takes 3 arguments (the value, undefined, and the iterator) and should
return a boolean.<dt>opt_obj: <code class="type">T=</code><dd>This is used as the 'this' object in f when called.</dl><tr><th>Returns<tr><td><dl>A new iterator that keeps elements in the
original iterator as long as the function is true.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l498">code »</a><span class="member"><a name="goog.iter.toArray">goog.iter.toArray</a> <span class="args">( iterable )</span> ⇒ <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></code></span></div><p>Converts the iterator to an array</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>The iterator to convert to an array.</dl><tr><th>Returns<tr><td><dl>An array of the elements the iterator iterates over.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l102">code »</a><span class="member"><a name="goog.iter.toIterator">goog.iter.toIterator</a> <span class="args">( iterable )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Returns an iterator that knows how to iterate over the values in the object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>iterable: <code class="type"><a href="namespace_goog_iter.html#goog.iter.Iterable">goog.iter.Iterable</a></code><dd>If the object is an iterator it
will be returned as is. If the object has a <code >__iterator__</code> method
that will be called to get the value iterator. If the object is an
array-like object we create an iterator for that.</dl><tr><th>Returns<tr><td><dl>An iterator that knows how to iterate over the
values in <code >iterable</code>.</dl></table></div></details></div></div></section><section id="static-properties"><h2>Global Properties</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/iter/iter.js.src.html#l45">code »</a><span class="member"><a name="goog.iter.StopIteration">goog.iter.StopIteration</a> : <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code></span></div><p>Singleton Error object that is used to terminate iterations.</summary></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>No data</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>No data</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>No data</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>