@qubit-ltd/json 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +219 -0
- package/README.zh_CN.md +194 -0
- package/dist/json.cjs +623 -0
- package/dist/json.cjs.map +1 -0
- package/dist/json.min.cjs +1 -0
- package/dist/json.min.cjs.map +1 -0
- package/dist/json.min.mjs +1 -0
- package/dist/json.min.mjs.map +1 -0
- package/dist/json.mjs +610 -0
- package/dist/json.mjs.map +1 -0
- package/doc/api/LosslessNumber.html +610 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Light-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Light-webfont.svg +1839 -0
- package/doc/api/fonts/OpenSans-Light-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.svg +1843 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.svg +1839 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/doc/api/global.html +1274 -0
- package/doc/api/index.html +236 -0
- package/doc/api/scripts/linenumber.js +34 -0
- package/doc/api/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/doc/api/scripts/prettify/lang-css.js +2 -0
- package/doc/api/scripts/prettify/prettify.js +28 -0
- package/doc/api/styles/jsdoc-default.css +699 -0
- package/doc/api/styles/prettify-jsdoc.css +120 -0
- package/doc/api/styles/prettify-tomorrow.css +141 -0
- package/doc/json.min.visualization.html +4949 -0
- package/doc/json.visualization.html +4949 -0
- package/package.json +87 -0
|
@@ -0,0 +1,1274 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>Global - Documentation</title>
|
|
7
|
+
|
|
8
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
9
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
10
|
+
<!--[if lt IE 9]>
|
|
11
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
|
12
|
+
<![endif]-->
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
|
|
14
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
15
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
|
|
19
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
20
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
21
|
+
<div class="navicon"></div>
|
|
22
|
+
</label>
|
|
23
|
+
|
|
24
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
25
|
+
|
|
26
|
+
<nav>
|
|
27
|
+
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="LosslessNumber.html">LosslessNumber</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LosslessNumber.html#toString">toString</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LosslessNumber.html#valueOf">valueOf</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#getUnsafeReason">getUnsafeReason</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isBigInt">isBigInt</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isInteger">isInteger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isNumber">isNumber</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isSafeNumber">isSafeNumber</a></span></li><li class="nav-item"><span class="nav-item-type type-member">M</span><span class="nav-item-name"><a href="global.html#json">json</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#toSafeNumberOrThrow">toSafeNumberOrThrow</a></span></li>
|
|
28
|
+
</nav>
|
|
29
|
+
|
|
30
|
+
<div id="main">
|
|
31
|
+
|
|
32
|
+
<h1 class="page-title">Global</h1>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<section>
|
|
41
|
+
|
|
42
|
+
<header>
|
|
43
|
+
|
|
44
|
+
<h2>
|
|
45
|
+
|
|
46
|
+
</h2>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</header>
|
|
50
|
+
|
|
51
|
+
<article>
|
|
52
|
+
<div class="container-overview">
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
<dl class="details">
|
|
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
|
+
</dl>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<h3 class="subsection-title">Members</h3>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
<div class="section-members">
|
|
115
|
+
<h4 class="name" id="json"><span class="type-signature">(constant) </span>json<span class="type-signature"> :object</span></h4>
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
<div class="description">
|
|
121
|
+
<p>A customized JSON object which supports lossless number parsing and stringifying.</p>
|
|
122
|
+
<p>This object provides two methods: <code>parse</code> and <code>stringify</code>, which are the same as the
|
|
123
|
+
<code>JSON.parse</code> and <code>JSON.stringify</code> methods, except that they support lossless number
|
|
124
|
+
parsing and stringifying.</p>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
<dl class="details">
|
|
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
|
+
</dl>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
<h5>Type:</h5>
|
|
169
|
+
<ul>
|
|
170
|
+
<li>
|
|
171
|
+
|
|
172
|
+
<span class="param-type"><code>object</code></span>
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
</li>
|
|
176
|
+
</ul>
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
<h3 class="subsection-title">Methods</h3>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
<div class="section-method">
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<h4 class="name" id="getUnsafeReason"><span class="type-signature"></span>getUnsafeReason<span class="signature">(value)</span><span class="type-signature"> → {string}</span></h4>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
<div class="description">
|
|
205
|
+
<p>When the provided value is an unsafe number, describe what the reason is</p>
|
|
206
|
+
<ul>
|
|
207
|
+
<li><code>'overflow'</code></li>
|
|
208
|
+
<li><code>'underflow'</code></li>
|
|
209
|
+
<li><code>'truncate_integer'</code></li>
|
|
210
|
+
<li><code>'truncate_float'</code></li>
|
|
211
|
+
<li><code>'none'</code> (when the value is safe)</li>
|
|
212
|
+
</ul>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
<dl class="details">
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
</dl>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
<h5>Parameters:</h5>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
<table class="params">
|
|
266
|
+
<thead>
|
|
267
|
+
<tr>
|
|
268
|
+
|
|
269
|
+
<th>Name</th>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
<th>Type</th>
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
<th class="last">Description</th>
|
|
279
|
+
</tr>
|
|
280
|
+
</thead>
|
|
281
|
+
|
|
282
|
+
<tbody>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<tr>
|
|
286
|
+
|
|
287
|
+
<td class="name"><code>value</code></td>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<td class="type">
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
<span class="param-type"><code>string</code></span>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
</td>
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
<td class="description last">
|
|
304
|
+
<p>The string represents a number to test.</p>
|
|
305
|
+
|
|
306
|
+
</td>
|
|
307
|
+
</tr>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
</tbody>
|
|
311
|
+
</table>
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
<div class="section-returns">
|
|
329
|
+
<h5>Returns:</h5>
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
<dl class="param-type">
|
|
334
|
+
<dt>
|
|
335
|
+
Type:
|
|
336
|
+
</dt>
|
|
337
|
+
<dd>
|
|
338
|
+
|
|
339
|
+
<span class="param-type"><code>string</code></span>
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
</dd>
|
|
343
|
+
</dl>
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
<div class="param-desc">
|
|
347
|
+
<p>The reason why the value is unsafe. Returns <code>'none'</code> when the value is safe.</p>
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
<div class="section-method">
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
<h4 class="name" id="isBigInt"><span class="type-signature"></span>isBigInt<span class="signature">(value)</span><span class="type-signature"> → {boolean}</span></h4>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
<div class="description">
|
|
373
|
+
<p>Test whether a string represents a BigInt.</p>
|
|
374
|
+
</div>
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
<dl class="details">
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
</dl>
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
<h5>Parameters:</h5>
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
<table class="params">
|
|
427
|
+
<thead>
|
|
428
|
+
<tr>
|
|
429
|
+
|
|
430
|
+
<th>Name</th>
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
<th>Type</th>
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
<th class="last">Description</th>
|
|
440
|
+
</tr>
|
|
441
|
+
</thead>
|
|
442
|
+
|
|
443
|
+
<tbody>
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
<tr>
|
|
447
|
+
|
|
448
|
+
<td class="name"><code>value</code></td>
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
<td class="type">
|
|
452
|
+
|
|
453
|
+
</td>
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
<td class="description last">
|
|
460
|
+
<p>The string to test.</p>
|
|
461
|
+
|
|
462
|
+
</td>
|
|
463
|
+
</tr>
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
</tbody>
|
|
467
|
+
</table>
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
<div class="section-returns">
|
|
485
|
+
<h5>Returns:</h5>
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
<dl class="param-type">
|
|
490
|
+
<dt>
|
|
491
|
+
Type:
|
|
492
|
+
</dt>
|
|
493
|
+
<dd>
|
|
494
|
+
|
|
495
|
+
<span class="param-type"><code>boolean</code></span>
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
</dd>
|
|
499
|
+
</dl>
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
<div class="param-desc">
|
|
503
|
+
<p>true if the string contains a BigInt; false otherwise.</p>
|
|
504
|
+
</div>
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
</div>
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
</div>
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
<div class="section-method">
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
<h4 class="name" id="isInteger"><span class="type-signature"></span>isInteger<span class="signature">(value)</span><span class="type-signature"> → {boolean}</span></h4>
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
<div class="description">
|
|
529
|
+
<p>Test whether a string represents an integer.</p>
|
|
530
|
+
</div>
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
<dl class="details">
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
</dl>
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
<h5>Parameters:</h5>
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
<table class="params">
|
|
583
|
+
<thead>
|
|
584
|
+
<tr>
|
|
585
|
+
|
|
586
|
+
<th>Name</th>
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
<th>Type</th>
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
<th class="last">Description</th>
|
|
596
|
+
</tr>
|
|
597
|
+
</thead>
|
|
598
|
+
|
|
599
|
+
<tbody>
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
<tr>
|
|
603
|
+
|
|
604
|
+
<td class="name"><code>value</code></td>
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
<td class="type">
|
|
608
|
+
|
|
609
|
+
</td>
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
<td class="description last">
|
|
616
|
+
<p>The string to test.</p>
|
|
617
|
+
|
|
618
|
+
</td>
|
|
619
|
+
</tr>
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
</tbody>
|
|
623
|
+
</table>
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
<div class="section-returns">
|
|
641
|
+
<h5>Returns:</h5>
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
<dl class="param-type">
|
|
646
|
+
<dt>
|
|
647
|
+
Type:
|
|
648
|
+
</dt>
|
|
649
|
+
<dd>
|
|
650
|
+
|
|
651
|
+
<span class="param-type"><code>boolean</code></span>
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
</dd>
|
|
655
|
+
</dl>
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
<div class="param-desc">
|
|
659
|
+
<p>true if the string contains an integer; false otherwise.</p>
|
|
660
|
+
</div>
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
</div>
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
</div>
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
<div class="section-method">
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
<h4 class="name" id="isNumber"><span class="type-signature"></span>isNumber<span class="signature">(value)</span><span class="type-signature"> → {boolean}</span></h4>
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
<div class="description">
|
|
685
|
+
<p>Test whether a string represents a number</p>
|
|
686
|
+
</div>
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
<dl class="details">
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
</dl>
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
<h5>Parameters:</h5>
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
<table class="params">
|
|
739
|
+
<thead>
|
|
740
|
+
<tr>
|
|
741
|
+
|
|
742
|
+
<th>Name</th>
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
<th>Type</th>
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
<th class="last">Description</th>
|
|
752
|
+
</tr>
|
|
753
|
+
</thead>
|
|
754
|
+
|
|
755
|
+
<tbody>
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
<tr>
|
|
759
|
+
|
|
760
|
+
<td class="name"><code>value</code></td>
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
<td class="type">
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
<span class="param-type"><code>string</code></span>
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
</td>
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
<td class="description last">
|
|
777
|
+
<p>The string to test.</p>
|
|
778
|
+
|
|
779
|
+
</td>
|
|
780
|
+
</tr>
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
</tbody>
|
|
784
|
+
</table>
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
<div class="section-returns">
|
|
802
|
+
<h5>Returns:</h5>
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
<dl class="param-type">
|
|
807
|
+
<dt>
|
|
808
|
+
Type:
|
|
809
|
+
</dt>
|
|
810
|
+
<dd>
|
|
811
|
+
|
|
812
|
+
<span class="param-type"><code>boolean</code></span>
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
</dd>
|
|
816
|
+
</dl>
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
<div class="param-desc">
|
|
820
|
+
<p>true if the string contains a number; false otherwise.</p>
|
|
821
|
+
</div>
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
</div>
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
</div>
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
<div class="section-method">
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
<h4 class="name" id="isSafeNumber"><span class="type-signature"></span>isSafeNumber<span class="signature">(value, options)</span><span class="type-signature"> → {boolean}</span></h4>
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
<div class="description">
|
|
846
|
+
<p>Test whether a string can be safely represented with a number without
|
|
847
|
+
information loss.</p>
|
|
848
|
+
<p>When the argument <code>approx</code> is true, floating point numbers that lose a few
|
|
849
|
+
digits but are still approximately equal in value are considered safe too.
|
|
850
|
+
Integer numbers must still be exactly equal.</p>
|
|
851
|
+
</div>
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
<dl class="details">
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
</dl>
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
<h5>Parameters:</h5>
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
<table class="params">
|
|
904
|
+
<thead>
|
|
905
|
+
<tr>
|
|
906
|
+
|
|
907
|
+
<th>Name</th>
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
<th>Type</th>
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
<th class="last">Description</th>
|
|
917
|
+
</tr>
|
|
918
|
+
</thead>
|
|
919
|
+
|
|
920
|
+
<tbody>
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
<tr>
|
|
924
|
+
|
|
925
|
+
<td class="name"><code>value</code></td>
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
<td class="type">
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
<span class="param-type"><code>string</code></span>
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
</td>
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
<td class="description last">
|
|
942
|
+
<p>The string to test.</p>
|
|
943
|
+
|
|
944
|
+
</td>
|
|
945
|
+
</tr>
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
<tr>
|
|
950
|
+
|
|
951
|
+
<td class="name"><code>options</code></td>
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
<td class="type">
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
<span class="param-type"><code>object</code></span>
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
</td>
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
<td class="description last">
|
|
968
|
+
<p>The options of the test. It may contain the following properties:
|
|
969
|
+
- <code>approx: boolean</code>: indicates whether to consider approximately equal
|
|
970
|
+
floating point numbers as safe. Default is <code>false</code>.
|
|
971
|
+
- <code>requiredDigits: number</code>: the number of significant digits required for
|
|
972
|
+
a floating point number to be considered approximately equal. Default
|
|
973
|
+
is <code>14</code>.</p>
|
|
974
|
+
|
|
975
|
+
</td>
|
|
976
|
+
</tr>
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
</tbody>
|
|
980
|
+
</table>
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
<div class="section-returns">
|
|
998
|
+
<h5>Returns:</h5>
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
<dl class="param-type">
|
|
1003
|
+
<dt>
|
|
1004
|
+
Type:
|
|
1005
|
+
</dt>
|
|
1006
|
+
<dd>
|
|
1007
|
+
|
|
1008
|
+
<span class="param-type"><code>boolean</code></span>
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
</dd>
|
|
1012
|
+
</dl>
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
<div class="param-desc">
|
|
1016
|
+
<p>true if the string can be safely represented with a number; false
|
|
1017
|
+
otherwise.</p>
|
|
1018
|
+
</div>
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
</div>
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
</div>
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
<div class="section-method">
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
<h4 class="name" id="toSafeNumberOrThrow"><span class="type-signature"></span>toSafeNumberOrThrow<span class="signature">(value, options)</span><span class="type-signature"> → {number}</span></h4>
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
<div class="description">
|
|
1043
|
+
<p>Convert a string into a number when it is safe to do so.
|
|
1044
|
+
Throws an error otherwise, explaining the reason.</p>
|
|
1045
|
+
</div>
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
<dl class="details">
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
</dl>
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
<h5>Parameters:</h5>
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
<table class="params">
|
|
1098
|
+
<thead>
|
|
1099
|
+
<tr>
|
|
1100
|
+
|
|
1101
|
+
<th>Name</th>
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
<th>Type</th>
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
<th class="last">Description</th>
|
|
1111
|
+
</tr>
|
|
1112
|
+
</thead>
|
|
1113
|
+
|
|
1114
|
+
<tbody>
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
<tr>
|
|
1118
|
+
|
|
1119
|
+
<td class="name"><code>value</code></td>
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
<td class="type">
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
<span class="param-type"><code>string</code></span>
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
</td>
|
|
1130
|
+
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
<td class="description last">
|
|
1136
|
+
<p>The string to convert into a number.</p>
|
|
1137
|
+
|
|
1138
|
+
</td>
|
|
1139
|
+
</tr>
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
<tr>
|
|
1144
|
+
|
|
1145
|
+
<td class="name"><code>options</code></td>
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
<td class="type">
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
<span class="param-type"><code>object</code></span>
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
</td>
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
<td class="description last">
|
|
1162
|
+
<p>The options for conversion.</p>
|
|
1163
|
+
|
|
1164
|
+
</td>
|
|
1165
|
+
</tr>
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
</tbody>
|
|
1169
|
+
</table>
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
<div class="section-throws">
|
|
1185
|
+
<h5>Throws:</h5>
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
<dl>
|
|
1190
|
+
<dt>
|
|
1191
|
+
<div class="param-desc">
|
|
1192
|
+
<p>When the value is not safe to convert.</p>
|
|
1193
|
+
</div>
|
|
1194
|
+
</dt>
|
|
1195
|
+
<dd></dd>
|
|
1196
|
+
<dt>
|
|
1197
|
+
<dl>
|
|
1198
|
+
<dt>
|
|
1199
|
+
Type
|
|
1200
|
+
</dt>
|
|
1201
|
+
<dd>
|
|
1202
|
+
|
|
1203
|
+
<span class="param-type"><code>Error</code></span>
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
</dd>
|
|
1207
|
+
</dl>
|
|
1208
|
+
</dt>
|
|
1209
|
+
<dd></dd>
|
|
1210
|
+
</dl>
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
</div>
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
<div class="section-returns">
|
|
1219
|
+
<h5>Returns:</h5>
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
<dl class="param-type">
|
|
1224
|
+
<dt>
|
|
1225
|
+
Type:
|
|
1226
|
+
</dt>
|
|
1227
|
+
<dd>
|
|
1228
|
+
|
|
1229
|
+
<span class="param-type"><code>number</code></span>
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
</dd>
|
|
1233
|
+
</dl>
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
<div class="param-desc">
|
|
1237
|
+
<p>The converted safe number.</p>
|
|
1238
|
+
</div>
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
</div>
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
</div>
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
</article>
|
|
1255
|
+
|
|
1256
|
+
</section>
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
</div>
|
|
1262
|
+
|
|
1263
|
+
<br class="clear">
|
|
1264
|
+
|
|
1265
|
+
<footer>
|
|
1266
|
+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
1267
|
+
on Sun Jan 05 2025 14:35:14 GMT+0800 (China Standard Time)
|
|
1268
|
+
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
1269
|
+
</footer>
|
|
1270
|
+
|
|
1271
|
+
<script>prettyPrint();</script>
|
|
1272
|
+
<script src="scripts/linenumber.js"></script>
|
|
1273
|
+
</body>
|
|
1274
|
+
</html>
|