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

Commit dd76e00

Browse files
authored
Add readme example with conversion from array, async map (#124)
* Add example w. conversion from array, async map Credit to @Jamesernator : tc39/proposal-async-iteration#134 (comment) * Remove extra await * Disable npm test (no test script specified) * Add .toArray() call Ref https://github.com/tc39/proposal-iterator-helpers/pull/124/files#r569479964
1 parent 60020e8 commit dd76e00

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ node_js:
44
branches:
55
only:
66
- master
7+
# See https://github.com/tc39/proposal-iterator-helpers/pull/124#issuecomment-771560244
8+
script: echo "npm test disabled"
79
after_success:
810
- $(npm bin)/set-up-ssh --key "${encrypted_7cd0ff475ed3_key}" --iv "${encrypted_7cd0ff475ed3_iv}" --path-encrypted-key .travis_github_deploy_key.enc
911
- $(npm bin)/update-branch --commands 'npm run build' --commit-message "Update gh-pages @ ${TRAVIS_COMMIT}" --directory 'dist' --distribution-branch 'gh-pages' --source-branch 'master'

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ class ObligatoryCryptocurrencyReference extends Component {
6363
}
6464
```
6565

66+
```js
67+
const responses = await AsyncIterator.from(urls)
68+
.map(async (url) => {
69+
const response = await fetch(url);
70+
return response.json();
71+
})
72+
.toArray();
73+
```
74+
6675
### Why not use Array.from + Array.prototype methods?
6776

6877
All of these methods (except for reduce and toArray) are **lazy**. They will

0 commit comments

Comments
 (0)