Skip to content

Commit f1503c3

Browse files
Streamline JS method chaining examples (#457)
1 parent 5f6a1c3 commit f1503c3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pages/docs/manual/latest/pipe.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,11 @@ asyncRequest()
8787
.send();
8888
```
8989

90-
Assuming we don't need the chaining behavior above, we'd bind to each case this using `bs.send` from the aforementioned binding API page:
90+
Assuming we don't need the chaining behavior above, we'd bind to each case this using [`@send`](/syntax-lookup#send-decorator) from the aforementioned binding API page:
9191

9292
<CodeTab labels={["ReScript", "JS Output"]}>
9393

9494
```res prelude
95-
@send external map: (array<'a>, 'a => 'b) => array<'b> = "map"
96-
@send external filter: (array<'a>, 'a => bool) => array<'a> = "filter"
97-
9895
type request
9996
@val external asyncRequest: unit => request = "asyncRequest"
10097
@send external setWaitDuration: (request, int) => request = "setWaitDuration"
@@ -136,8 +133,8 @@ This looks much worse than the JS counterpart! Clean it up visually with pipe:
136133

137134
```res example
138135
let result = [1, 2, 3]
139-
->map(a => a + 1)
140-
->filter(a => mod(a, 2) == 0)
136+
->Js.Array2.map(a => a + 1)
137+
->Js.Array2.filter(a => mod(a, 2) == 0)
141138
142139
asyncRequest()->setWaitDuration(4000)->send
143140
```

0 commit comments

Comments
 (0)