Skip to content

Commit af41dd8

Browse files
committed
[Docs] Add to_js_boolean; polish null/undefined
1 parent 7f3c25c commit af41dd8

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

site/docsource/Runtime-representation.adoc

+19-5
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,16 @@ For example:
120120
[source,ocaml]
121121
.Js module
122122
-----
123-
val Js.to_bool: Js.boolean -> bool
123+
type boolean
124+
val to_bool: boolean -> bool
124125
-----
125126
126-
| `'a Js.Null.t` a| either `'a` or `null`. `Js.Null.empty` represents `null` too.
127+
.Js.Boolean module
128+
-----
129+
val to_js_boolean: bool -> Js.boolean
130+
-----
131+
132+
| `'a Js.Null.t` a| Either `'a` or `null`. `Js.Null.empty` represents `null` too.
127133
128134
[source,ocaml]
129135
.Js.Null module
@@ -134,11 +140,19 @@ val return : 'a -> 'a t
134140
val test : 'a t -> bool
135141
--------------
136142
137-
| `'a Js.Undefined.t` a| either `'a` or `undefined`.
138-
Same operations as `'a Js.Null.t`.
143+
| `'a Js.Undefined.t` a| Either `'a` or `undefined`.
144+
Same operations as `'a Js.Null.t`. `Js.Undefined.empty` represents `undefined` too.
139145
140-
|`'a Js.Null_undefined.t` a| either `'a`, `null` or `undef`.
146+
|`'a Js.Null_undefined.t` a| Either `'a`, `null` or `undefined`.
141147
Same operations as `'a Js.Null.t`.
148+
149+
`Js.Null_undefined.undefined` represents `undefined`,
150+
`Js.Null_undefined.null` represents `null`.
151+
152+
This module's null tests check for both `null` and `undefined`; if you know the
153+
value's only ever going to be `null` and not undefined, use `Js.Null` instead.
154+
Likewise for `Js.Undefined`.
155+
142156
|==============
143157
144158
NOTE: `Js.to_opt` is optimized when the `option` is not escaped

0 commit comments

Comments
 (0)