https://github.com/rocky-jaiswal/async-utils
Async function utils
https://github.com/rocky-jaiswal/async-utils
Last synced: 8 months ago
JSON representation
Async function utils
- Host: GitHub
- URL: https://github.com/rocky-jaiswal/async-utils
- Owner: rocky-jaiswal
- License: mit
- Created: 2021-03-08T13:53:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T15:59:08.000Z (about 3 years ago)
- Last Synced: 2024-06-11T18:55:21.000Z (over 1 year ago)
- Language: TypeScript
- Size: 119 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Async-Utils
Compose async functions with ease
```
const arr: number[] = []
const f1 = async (a: number[]) => {
await delay(300)
a.push(1)
return a
}
const f2 = async (a: number[]) => {
await delay(200)
a.push(2)
return a
}
const f3 = async (a: number[]) => {
await delay(100)
a.push(3)
return a
}
const res = await pipeAsync(f1, f2, f3)(arr)
console.log(res) // [1, 2, 3]
```