Skip to content

Commit f30cc77

Browse files
committed
update readme example with renaming
1 parent 368213b commit f30cc77

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ https://github.com/tc39/proposal-iterator-helpers.
99

1010
```ts
1111
import {
12-
asyncIteratorFrom,
13-
iteratorFrom,
14-
wrapAsyncIterator,
15-
wrapIterator,
12+
asyncIteratorFrom as fromA,
13+
iteratorFrom as from,
14+
wrapAsyncIterator as wrapA,
15+
wrapIterator as wrap,
1616
} from "https://deno.land/x/iterator_helpers/mod.ts";
1717

1818
function* naturals() {
@@ -23,20 +23,20 @@ function* naturals() {
2323
}
2424
}
2525

26-
const arr1 = wrapIterator(naturals())
26+
const arr1 = wrap(naturals())
2727
.filter((n) => n % 2 === 1) // filter odd numbers
2828
.map((n) => n ** 2) // square numbers
2929
.flatMap((n) => [n, n]) // twice each numbers
3030
.take(10) // cut up to 10 items
3131
.toArray(); // evaluate and collect items into array
3232
console.log(arr1); // [1, 1, 9, 9, 25, 25, 49, 49, 81, 81]
3333

34-
const arr2 = await wrapAsyncIterator(asyncIteratorFrom(naturals()))
34+
const arr2 = await wrapA(fromA(naturals()))
3535
.filter(async (n) => {
3636
const res = await fetch(`https://api.isevenapi.xyz/api/iseven/${n}/`);
3737
if (!res.body) throw new Error("No body");
3838
const raw = Uint8Array.from(
39-
await wrapAsyncIterator(asyncIteratorFrom(res.body))
39+
await wrapA(fromA(res.body))
4040
.flatMap((e) => e)
4141
.toArray(),
4242
);

0 commit comments

Comments
 (0)