Skip to content

Commit

Permalink
fixes #143: rename asIndexedPairs to indexed (#183)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Ficarra <mficarra@shapesecurity.com>
  • Loading branch information
bakkot and michaelficarra committed Jul 6, 2022
1 parent aacb5bc commit 63567bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -133,9 +133,9 @@ result.next(); // {value: 4, done: false};
result.next(); // {value: 5, done: false};
```

### `.asIndexedPairs()`
### `.indexed()`

`.asIndexedPairs` takes no arguments. It returns an iterator where each value produced by the underlying iterator is paired with a counter, starting at 0 and increasing by 1 with every element produced.
`.indexed` takes no arguments. It returns an iterator where each value produced by the underlying iterator is paired with a counter, starting at 0 and increasing by 1 with every element produced.

Returns an iterator of pairs.

Expand All @@ -145,7 +145,7 @@ Returns an iterator of pairs.
const abc = ["a", "b", "c"].values();

const result = abc
.asIndexedPairs();
.indexed();
result.next(); // {value: [0, "a"], done: false};
result.next(); // {value: [1, "b"], done: false};
result.next(); // {value: [2, "c"], done: false};
Expand Down
8 changes: 4 additions & 4 deletions spec.html
Expand Up @@ -579,8 +579,8 @@ <h1>%Iterator.prototype%.drop ( _limit_ )</h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-iteratorprototype.asindexedpairs">
<h1>%Iterator.prototype%.asIndexedPairs ( )</h1>
<emu-clause id="sec-iteratorprototype.indexed">
<h1>%Iterator.prototype%.indexed ( )</h1>
<emu-alg>
1. Let _iterated_ be ? GetIteratorDirect(*this* value).
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and performs the following steps when called:
Expand Down Expand Up @@ -824,8 +824,8 @@ <h1>%AsyncIterator.prototype%.drop ( _limit_ )</h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-asynciteratorprototype.asindexedpairs">
<h1>%AsyncIterator.prototype%.asIndexedPairs ( )</h1>
<emu-clause id="sec-asynciteratorprototype.indexed">
<h1>%AsyncIterator.prototype%.indexed ( )</h1>
<emu-alg>
1. Let _iterated_ be ? GetIteratorDirect(*this* value).
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and performs the following steps when called:
Expand Down

0 comments on commit 63567bb

Please sign in to comment.