Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

fixes #143: rename asIndexedPairs to indexed #183

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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