File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,38 @@ const result = pipe(
4747console .log (result ); // "4"
4848```
4949
50+ ## Difference
51+
52+ The ` pipe ` function in the root module is equivalent to function calls without
53+ ` await ` like below.
54+
55+ ``` ts
56+ import { pipe } from " @core/pipe/pipe" ;
57+
58+ const a = (v : unknown ) => v ;
59+ const b = (v : unknown ) => v ;
60+ const c = (v : unknown ) => v ;
61+
62+ // Equivalent
63+ console .log (pipe (1 , a , b , c )); // 1
64+ console .log (c (b (a (1 )))); // 1
65+ ```
66+
67+ The ` pipe ` function in the ` async ` module is equivalent to function calls with
68+ ` await ` like below.
69+
70+ ``` ts
71+ import { pipe } from " @core/pipe/async/pipe" ;
72+
73+ const a = (v : unknown ) => Promise .resolve (v );
74+ const b = (v : unknown ) => Promise .resolve (v );
75+ const c = (v : unknown ) => Promise .resolve (v );
76+
77+ // Equivalent
78+ console .log (await pipe (1 , a , b , c )); // 1
79+ console .log (await c (await b (await a (1 )))); // 1
80+ ```
81+
5082## License
5183
5284The code follows MIT license written in [ LICENSE] ( ./LICENSE ) . Contributors need
You can’t perform that action at this time.
0 commit comments