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

Add readme example with conversion from array, async map #124

Merged
merged 4 commits into from
Jun 23, 2021
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
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ node_js:
branches:
only:
- master
# See https://github.com/tc39/proposal-iterator-helpers/pull/124#issuecomment-771560244
script: echo "npm test disabled"
after_success:
- $(npm bin)/set-up-ssh --key "${encrypted_7cd0ff475ed3_key}" --iv "${encrypted_7cd0ff475ed3_iv}" --path-encrypted-key .travis_github_deploy_key.enc
- $(npm bin)/update-branch --commands 'npm run build' --commit-message "Update gh-pages @ ${TRAVIS_COMMIT}" --directory 'dist' --distribution-branch 'gh-pages' --source-branch 'master'
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ class ObligatoryCryptocurrencyReference extends Component {
}
```

```js
const responses = await AsyncIterator.from(urls)
.map(async (url) => {
const response = await fetch(url);
return response.json();
})
.toArray();
```

### Why not use Array.from + Array.prototype methods?

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