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