forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJs.Null_undefined.html
190 lines (147 loc) · 9.04 KB
/
Js.Null_undefined.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="../api_static/tomorrow-night.css">
<link rel="stylesheet" href="../api_static/style.css" type="text/css">
<script src="../api_static//highlight.pack.js"></script>
<script src="../api_static//script.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<meta charset="utf8">
<link rel="previous" href="Js.Nullable.html"><link rel="next" href="Js.Exn.html">
<title> Js.Null_undefined </title></head>
<body>
<nav class="module-index"><ul><li><a href="Bs.html">Bs</a></li>
<li><a href="Bs_dyn.html">Bs_dyn</a></li>
<li><a href="Bs_dyn_lib.html">Bs_dyn_lib</a></li>
<li><a href="Dom.html">Dom</a></li>
<li><a href="Dom_storage.html">Dom_storage</a></li>
<li><a href="Js.html">Js</a></li>
<li><a href="Js_array.html">Js_array</a></li>
<li><a href="Js_boolean.html">Js_boolean</a></li>
<li><a href="Js_cast.html">Js_cast</a></li>
<li><a href="Js_date.html">Js_date</a></li>
<li><a href="Js_dict.html">Js_dict</a></li>
<li><a href="Js_exn.html">Js_exn</a></li>
<li><a href="Js_float.html">Js_float</a></li>
<li><a href="Js_global.html">Js_global</a></li>
<li><a href="Js_int.html">Js_int</a></li>
<li><a href="Js_int64.html">Js_int64</a></li>
<li><a href="Js_internal.html">Js_internal</a></li>
<li><a href="Js_json.html">Js_json</a></li>
<li><a href="Js_list.html">Js_list</a></li>
<li><a href="Js_math.html">Js_math</a></li>
<li><a href="Js_nativeint.html">Js_nativeint</a></li>
<li><a href="Js_null.html">Js_null</a></li>
<li><a href="Js_null_undefined.html">Js_null_undefined</a></li>
<li><a href="Js_obj.html">Js_obj</a></li>
<li><a href="Js_option.html">Js_option</a></li>
<li><a href="Js_primitive.html">Js_primitive</a></li>
<li><a href="Js_promise.html">Js_promise</a></li>
<li><a href="Js_re.html">Js_re</a></li>
<li><a href="Js_result.html">Js_result</a></li>
<li><a href="Js_string.html">Js_string</a></li>
<li><a href="Js_typed_array.html">Js_typed_array</a></li>
<li><a href="Js_types.html">Js_types</a></li>
<li><a href="Js_undefined.html">Js_undefined</a></li>
<li><a href="Js_unsafe.html">Js_unsafe</a></li>
<li><a href="Js_vector.html">Js_vector</a></li>
<li><a href="Node.html">Node</a></li>
<li><a href="Node_buffer.html">Node_buffer</a></li>
<li><a href="Node_child_process.html">Node_child_process</a></li>
<li><a href="Node_fs.html">Node_fs</a></li>
<li><a href="Node_module.html">Node_module</a></li>
<li><a href="Node_path.html">Node_path</a></li>
<li><a href="Node_process.html">Node_process</a></li></ul></nav>
<div class="navbar"><a class="pre" href="Js.Nullable.html" title="Js.Nullable">Previous</a>
<a class="up" href="Js.html" title="Js">Up</a>
<a class="post" href="Js.Exn.html" title="Js.Exn">Next</a>
</div>
<h1>Module <a href="type_Js.Null_undefined.html">Js.Null_undefined</a></h1>
<pre><span class="keyword">module</span> Null_undefined: <code class="type"><a href="Js_null_undefined.html">Js_null_undefined</a></code></pre><hr width="100%">
<div class="type-declaration">
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> = <code class="type">'a <a href="Js.html#TYPEnull_undefined">Js.null_undefined</a></code> </pre>
</div>
<div class="info ">
<div class="not-examples">
Local alias for <code class="code">'a Js.null_undefined</code><br>
</div>
</div>
<pre><span id="VALreturn"><span class="keyword">val</span> return</span> : <code class="type">'a -> 'a <a href="Js_null_undefined.html#TYPEt">t</a></code></pre><div class="info ">
<div class="not-examples">
Constructs a value of <code class="code">'a Js.null_undefined</code> containing a value of <code class="code">'a</code><br>
</div>
</div>
<pre><span id="VALtest"><span class="keyword">val</span> test</span> : <code class="type">'a <a href="Js_null_undefined.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<div class="not-examples">
Returns <code class="code">true</code> if the given value is <code class="code">null</code> or <code class="code">undefined</code>, <code class="code">false</code> otherwise<br>
</div>
</div>
<pre><span id="VALnull"><span class="keyword">val</span> null</span> : <code class="type">'a <a href="Js_null_undefined.html#TYPEt">t</a></code></pre><div class="info ">
<div class="not-examples">
The <code class="code">null</code> value of type <code class="code">'a Js.null_undefined</code><br>
</div>
</div>
<pre><span id="VALundefined"><span class="keyword">val</span> undefined</span> : <code class="type">'a <a href="Js_null_undefined.html#TYPEt">t</a></code></pre><div class="info ">
<div class="not-examples">
The <code class="code">undefined</code> value of type <code class="code">'a Js.null_undefined</code><br>
</div>
</div>
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">'a <a href="Js_null_undefined.html#TYPEt">t</a></code></pre><div class="info ">
<div class="not-examples">
<div class="warning">
<span class="label">Deprecated.</span>
Use <a href="Js_null_undefined.html#VALnull"><code class="code">Js_null_undefined.null</code></a> or <a href="Js_null_undefined.html#VALundefined"><code class="code">Js_null_undefined.undefined</code></a> instead
</div>
The empty value, <code class="code">undefined</code><br>
</div>
</div>
<pre><span id="VALbind"><span class="keyword">val</span> bind</span> : <code class="type">'a <a href="Js_null_undefined.html#TYPEt">t</a> -> ('a -> 'b [@bs]) -> 'b <a href="Js_null_undefined.html#TYPEt">t</a></code></pre><div class="info ">
<div class="not-examples">
Maps the contained value using the given function
<p>
If <code class="code">'a Js.null_undefined</code> contains a value, that value is unwrapped, mapped to a <code class="code">'b</code> using
the given function <code class="code">a' -> 'b</code>, then wrapped back up and returned as <code class="code">'b Js.null_undefined</code><br>
</div>
<div class="examples">
<pre class="example"> <pre class="codepre"><code class="code">let maybeGreetWorld (maybeGreeting: string Js.null_undefined) =
Js.Undefined.bind maybeGreeting (fun greeting -> greeting ^ " world!")
</code></pre> </pre>
</div>
</div>
<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">'a <a href="Js_null_undefined.html#TYPEt">t</a> -> ('a -> unit [@bs]) -> unit</code></pre><div class="info ">
<div class="not-examples">
Iterates over the contained value with the given function
<p>
If <code class="code">'a Js.null_undefined</code> contains a value, that value is unwrapped and applied to
the given function.<br>
</div>
<div class="examples">
<pre class="example"> <pre class="codepre"><code class="code">let maybeSay (maybeMessage: string Js.null_undefined) =
Js.Null_undefined.iter maybeMessage (fun message -> Js.log message)
</code></pre> </pre>
</div>
</div>
<pre><span id="VALfrom_opt"><span class="keyword">val</span> from_opt</span> : <code class="type">'a option -> 'a <a href="Js_null_undefined.html#TYPEt">t</a></code></pre><div class="info ">
<div class="not-examples">
Maps <code class="code">'a option</code> to <code class="code">'a Js.null_undefined</code>
<p>
<table>
<tr> <td>Some a <td>-> <td>return a
<tr> <td>None <td>-> <td>undefined
</table>
<br>
</div>
</div>
<pre><span id="VALto_opt"><span class="keyword">val</span> to_opt</span> : <code class="type">'a <a href="Js_null_undefined.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
<div class="not-examples">
Maps <code class="code">'a Js.null_undefined</code> to <code class="code">'a option</code>
<p>
<table>
<tr> <td>return a <td>-> <td>Some a
<tr> <td>undefined <td>-> <td>None
<tr> <td>null <td>-> <td>None
</table>
<br>
</div>
</div>
</body></html>