MCPcopy Create free account
hub / github.com/ampproject/amphtml / createIndexedInterator

Function createIndexedInterator

build-system/tasks/e2e/driver/query-xpath.js:156–162  ·  view source on GitHub ↗

* Create an iterator from an existing iterator, which nests the original * value under the `item` property in the iteration object value and adds an * `index` property. * @template T * @param {!Iterable } iter * @return {!Iterable<{item: T, index: number}>}

(iter)

Source from the content-addressed store, hash-verified

154 * @return {!Iterable<{item: T, index: number}>}
155 */
156function* createIndexedInterator(iter) {
157 let index = 0;
158 for (const item of iter) {
159 yield {item, index};
160 index++;
161 }
162}
163
164window.queryXpath = queryXpath;

Callers 1

queryXpathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected