Skip to content

Commit

Permalink
feat(website): more playground examples in tsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerAberbach committed Nov 30, 2024
1 parent db9edf6 commit 7faea71
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 69 deletions.
22 changes: 17 additions & 5 deletions src/operations/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,24 @@ export const asAsync: <Value>(
* operations.
*
* @example
* ```js
* const slothNamesConcurIterable = pipe(
* asConcur(['sloth-names1.txt', 'sloth-names2.txt']),
* mapConcur(filename => fs.promises.readFile(filename, `utf8`)),
* flatMapConcur(content => content.split(`\n`)),
* ```js playground
* import { asConcur, mapConcur, pipe } from 'lfi'
*
* const API_URL = `https://api.dictionaryapi.dev/api/v2/entries/en`
*
* const concurIterable = pipe(
* asConcur([`sloth`, `lazy`, `sleep`]),
* mapConcur(async word => {
* const response = await fetch(`${API_URL}/${word}`)
* return (await response.json())[0].phonetic
* }),
* )
*
* await concurIterable(console.log)
* // NOTE: This order may change between runs
* //=> /slɑθ/
* //=> /ˈleɪzi/
* //=> /sliːp/
* ```
*
* @category Core
Expand Down
Loading

0 comments on commit 7faea71

Please sign in to comment.