From b5617264796b0d1f5f08060e059a466aa610b6ea Mon Sep 17 00:00:00 2001 From: Florian Hammerschmidt Date: Fri, 29 Oct 2021 12:43:23 +0200 Subject: [PATCH] Streamline JS method chaining examples --- pages/docs/manual/latest/pipe.mdx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pages/docs/manual/latest/pipe.mdx b/pages/docs/manual/latest/pipe.mdx index dcfe41628..776c268bb 100644 --- a/pages/docs/manual/latest/pipe.mdx +++ b/pages/docs/manual/latest/pipe.mdx @@ -87,14 +87,11 @@ asyncRequest() .send(); ``` -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: +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: ```res prelude -@send external map: (array<'a>, 'a => 'b) => array<'b> = "map" -@send external filter: (array<'a>, 'a => bool) => array<'a> = "filter" - type request @val external asyncRequest: unit => request = "asyncRequest" @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: ```res example let result = [1, 2, 3] - ->map(a => a + 1) - ->filter(a => mod(a, 2) == 0) + ->Js.Array2.map(a => a + 1) + ->Js.Array2.filter(a => mod(a, 2) == 0) asyncRequest()->setWaitDuration(4000)->send ```