Skip to content

Commit 64fa27d

Browse files
committed
Some doc code fixes
1 parent 62caac6 commit 64fa27d

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

pages/docs/manual/latest/bind-to-global-js-values.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ you can bind to an arbitrarily deep object by passing a tuple to `bs.scope`:
8282

8383
```res
8484
@bs.val @bs.scope(("window", "___location", "ancestorOrigins"))
85-
external length : int = "length"
85+
external length: int = "length"
8686
```
8787
```js
8888
// Empty output

pages/docs/manual/latest/bind-to-js-function.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ external processOnExit: (
293293
@bs.as("exit") _,
294294
int => unit
295295
) => unit = "process.on"
296-
let () = processOnExit(exitCode =>
296+
297+
processOnExit(exitCode =>
297298
Js.log("error code: " ++ Js.Int.toString(exitCode))
298299
);
299300
```
@@ -424,8 +425,10 @@ For JS functions that return a value that can also be `undefined` or `null`, we
424425
```res
425426
type element
426427
type dom
428+
427429
@bs.send @bs.return(nullable)
428430
external getElementById: (dom, string) => option<element> = "getElementById"
431+
429432
let test = dom => {
430433
let elem = dom->(getElementById("haha"))
431434
switch (elem) {

pages/docs/manual/latest/interop-cheatsheet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Final escape hatch converter. Do not abuse.
189189
<CodeTab labels={["ReScript", "JS Output"]}>
190190

191191
```res
192-
external convertToFloat : int => float = "%identity"
192+
external convertToFloat: int => float = "%identity"
193193
let age = 10
194194
let gpa = 2.1 +. convertToFloat(age)
195195
```

pages/docs/manual/latest/lazy-values.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ console.log(CamlinternalLazy.force(getFiles));
5555

5656
</CodeTab>
5757

58-
... or you can also wrap an existing function to make it lazy:
58+
...or you can also wrap an existing function to make it lazy:
5959

6060
<CodeTab labels={["ReScript", "JS Output"]}>
6161

@@ -252,11 +252,9 @@ Whenever a lazy value computation raises an exception, the same exception will b
252252

253253
```res example
254254
let readFile =
255-
lazy(
256-
{
257-
raise(Not_found)
258-
}
259-
)
255+
lazy({
256+
raise(Not_found)
257+
})
260258
261259
try {
262260
Lazy.force(readFile)

pages/docs/manual/latest/pipe.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ You'd use them like this:
111111
<CodeTab labels={["ReScript", "JS Output"]}>
112112

113113
```res
114-
let result = Js.Array2.filter(Js.Array2.map([1, 2, 3], a => a + 1), a => mod(a, 2) == 0)
114+
let result = Js.Array2.filter(
115+
Js.Array2.map([1, 2, 3], a => a + 1),
116+
a => mod(a, 2) == 0
117+
)
115118
116119
send(setWaitDuration(asyncRequest(), 4000))
117120
```
@@ -134,7 +137,7 @@ This looks much worse than the JS counterpart! Clean it up visually with pipe:
134137
```res
135138
let result = [1, 2, 3]
136139
->map(a => a + 1)
137-
->filter(a => mod(a, 2) === 0)
140+
->filter(a => mod(a, 2) == 0)
138141
139142
asyncRequest()->setWaitDuration(4000)->send
140143
```

0 commit comments

Comments
 (0)