Skip to content

Commit 0998f46

Browse files
committed
feat(async): add async pipe function
1 parent f6f3a75 commit 0998f46

File tree

4 files changed

+657
-1
lines changed

4 files changed

+657
-1
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ const result = pipe(
3232
console.log(result); // "4"
3333
```
3434

35+
Or use `async` module to pipe a value through a series of asynchronous operator
36+
functions.
37+
38+
```ts
39+
import { pipe } from "@core/pipe/async";
40+
41+
const result = pipe(
42+
1,
43+
(v) => Promise.resolve(v + 1), // inferred as (v: number) => number
44+
(v) => Promise.resolve(v * 2), // inferred as (v: number) => number
45+
(v) => Promise.resolve(v.toString()), // inferred as (v: number) => string
46+
);
47+
console.log(result); // "4"
48+
```
49+
3550
## License
3651

3752
The code follows MIT license written in [LICENSE](./LICENSE). Contributors need

0 commit comments

Comments
 (0)