@qubit-ltd/json 1.2.0 → 1.2.2

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.
Files changed (63) hide show
  1. package/doc/api/LosslessNumber.html +3 -610
  2. package/doc/api/data/search.json +1 -0
  3. package/doc/api/fonts/Inconsolata-Regular.ttf +0 -0
  4. package/doc/api/fonts/OpenSans-Regular.ttf +0 -0
  5. package/doc/api/fonts/WorkSans-Bold.ttf +0 -0
  6. package/doc/api/global.html +3 -1274
  7. package/doc/api/index.html +63 -264
  8. package/doc/api/scripts/core.js +726 -0
  9. package/doc/api/scripts/core.min.js +23 -0
  10. package/doc/api/scripts/resize.js +90 -0
  11. package/doc/api/scripts/search.js +265 -0
  12. package/doc/api/scripts/search.min.js +6 -0
  13. package/doc/api/scripts/{prettify → third-party}/Apache-License-2.0.txt +202 -202
  14. package/doc/api/scripts/third-party/fuse.js +9 -0
  15. package/doc/api/scripts/third-party/hljs-line-num-original.js +369 -0
  16. package/doc/api/scripts/third-party/hljs-line-num.js +1 -0
  17. package/doc/api/scripts/third-party/hljs-original.js +5171 -0
  18. package/doc/api/scripts/third-party/hljs.js +1 -0
  19. package/doc/api/scripts/third-party/popper.js +5 -0
  20. package/doc/api/scripts/third-party/tippy.js +1 -0
  21. package/doc/api/scripts/third-party/tocbot.js +672 -0
  22. package/doc/api/scripts/third-party/tocbot.min.js +1 -0
  23. package/doc/api/styles/clean-jsdoc-theme-base.css +1159 -0
  24. package/doc/api/styles/clean-jsdoc-theme-dark.css +412 -0
  25. package/doc/api/styles/clean-jsdoc-theme-light.css +482 -0
  26. package/doc/api/styles/clean-jsdoc-theme-scrollbar.css +30 -0
  27. package/doc/api/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
  28. package/doc/api/styles/clean-jsdoc-theme.min.css +1 -0
  29. package/doc/json.min.visualization.html +1 -1
  30. package/doc/json.visualization.html +1 -1
  31. package/package.json +2 -3
  32. package/doc/api/fonts/OpenSans-Bold-webfont.eot +0 -0
  33. package/doc/api/fonts/OpenSans-Bold-webfont.svg +0 -1838
  34. package/doc/api/fonts/OpenSans-Bold-webfont.woff +0 -0
  35. package/doc/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  36. package/doc/api/fonts/OpenSans-BoldItalic-webfont.svg +0 -1838
  37. package/doc/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  38. package/doc/api/fonts/OpenSans-Italic-webfont.eot +0 -0
  39. package/doc/api/fonts/OpenSans-Italic-webfont.svg +0 -1838
  40. package/doc/api/fonts/OpenSans-Italic-webfont.woff +0 -0
  41. package/doc/api/fonts/OpenSans-Light-webfont.eot +0 -0
  42. package/doc/api/fonts/OpenSans-Light-webfont.svg +0 -1839
  43. package/doc/api/fonts/OpenSans-Light-webfont.woff +0 -0
  44. package/doc/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  45. package/doc/api/fonts/OpenSans-LightItalic-webfont.svg +0 -1843
  46. package/doc/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  47. package/doc/api/fonts/OpenSans-Regular-webfont.eot +0 -0
  48. package/doc/api/fonts/OpenSans-Regular-webfont.svg +0 -1839
  49. package/doc/api/fonts/OpenSans-Regular-webfont.woff +0 -0
  50. package/doc/api/fonts/OpenSans-Semibold-webfont.eot +0 -0
  51. package/doc/api/fonts/OpenSans-Semibold-webfont.svg +0 -1838
  52. package/doc/api/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  53. package/doc/api/fonts/OpenSans-Semibold-webfont.woff +0 -0
  54. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  55. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1838
  56. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  57. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  58. package/doc/api/scripts/linenumber.js +0 -34
  59. package/doc/api/scripts/prettify/lang-css.js +0 -2
  60. package/doc/api/scripts/prettify/prettify.js +0 -28
  61. package/doc/api/styles/jsdoc-default.css +0 -699
  62. package/doc/api/styles/prettify-jsdoc.css +0 -120
  63. package/doc/api/styles/prettify-tomorrow.css +0 -141
@@ -1,99 +1,10 @@
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>Home - Documentation</title>
1
+ <!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Home</title><!--[if lt IE 9]>
2
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
3
+ <![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="dark"><div class="sidebar-container"><div class="sidebar" id="sidebar"><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="LosslessNumber.html">LosslessNumber</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#getUnsafeReason">getUnsafeReason</a></div><div class="sidebar-section-children"><a href="global.html#isBigInt">isBigInt</a></div><div class="sidebar-section-children"><a href="global.html#isInteger">isInteger</a></div><div class="sidebar-section-children"><a href="global.html#isNumber">isNumber</a></div><div class="sidebar-section-children"><a href="global.html#isSafeNumber">isSafeNumber</a></div><div class="sidebar-section-children"><a href="global.html#json">json</a></div><div class="sidebar-section-children"><a href="global.html#toSafeNumberOrThrow">toSafeNumberOrThrow</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section class="readme"><article><h1>增强的 JSON 解析器,支持大整数和集合</h1><p><a href="https://npmjs.com/package/@qubit-ltd/json"><img src="https://img.shields.io/npm/v/@qubit-ltd/json.svg" alt="npm package"></a><a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/badge/License-Apache-blue.svg" alt="License"></a><a href="README.md"><img src="https://img.shields.io/badge/Document-English-blue.svg" alt="English Document"></a><a href="https://dl.circleci.com/status-badge/redirect/gh/Haixing-Hu/js-json/tree/master"><img src="https://dl.circleci.com/status-badge/img/gh/Haixing-Hu/js-json/tree/master.svg?style=shield" alt="CircleCI"></a><a href="https://coveralls.io/github/Haixing-Hu/js-json?branch=master"><img src="https://coveralls.io/repos/github/Haixing-Hu/js-json/badge.svg?branch=master" alt="Coverage Status"></a></p><p><a href="https://npmjs.com/package/@qubit-ltd/json">@qubit-ltd/json</a> 是一个 JavaScript 库,它扩展了标准 JSON 对象的功能,提供了对超出 JavaScript 安全范围的大数字的强大支持。该库增强了解析和字符串化能力,使其非常适合处理大型数据集和复杂的数值操作, 同时保持 JSON 的结构。</p><h2>主要功能</h2><ul><li><strong><code>BigInt</code> 支持</strong>:在解析 JSON 字符串时,超出 JavaScript 安全整数范围的数字会自动转换为原生 <code>BigInt</code>, 确保精度不丢失。</li><li><strong><code>LosslessNumber</code> 处理</strong>:对于无法在 JavaScript 中准确表示的浮点数,该库引入了 <code>LosslessNumber</code> 对象。 这个轻量级对象以字符串形式保存完整的数值精度,允许灵活地转换为数字或 <code>BigInt</code> 进行数学运算。</li><li><strong>精确的字符串化</strong>:在字符串化过程中,<code>BigInt</code> 值会作为字符串序列化,不带 &quot;n&quot; 后缀,以保持与标准 JSON 格式的兼容性。 同样,<code>LosslessNumber</code> 对象使用其内部字符串表示进行序列化。</li><li><strong>集合序列化</strong>:JavaScript 原生的集合类型如 <code>Set</code> 和 <code>Map</code> 会无缝地序列化为数组,以便更好地与 JSON 结构兼容。</li></ul><p>有关为什么 JSON 解析可能会破坏大数字以及该库如何帮助解决该问题的更多详细信息,请参阅 <a href="https://jsoneditoronline.org/indepth/parse/why-does-json-parse-corrupt-large-numbers/">Why does JSON.parse corrupt large numbers and how to solve this?</a>。</p><h2>安装</h2><p>使用 npm 或 yarn 安装该库:</p><pre class="prettyprint source lang-sh"><code>npm install @qubit-ltd/json
4
+ </code></pre><p>或</p><pre class="prettyprint source lang-sh"><code>yarn add @qubit-ltd/json
5
+ </code></pre><h2>核心功能</h2><h3>类似 JSON 的对象</h3><p>该库提供了一个类似于标准 JSON 对象的对象,但具有增强的功能,用于处理大整数、浮点数以及集合类型如 Set 和 Map。</p><pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
7
6
 
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
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
- <section class="readme">
51
- <article><h1>Enhanced JSON Parsing and Stringification for Large Numbers and Collections</h1>
52
- <p><a href="https://npmjs.com/package/@qubit-ltd/json"><img src="https://img.shields.io/npm/v/@qubit-ltd/json.svg" alt="npm package"></a>
53
- <a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/badge/License-Apache-blue.svg" alt="License"></a>
54
- <a href="README.zh_CN.md"><img src="https://img.shields.io/badge/%E6%96%87%E6%A1%A3-%E4%B8%AD%E6%96%87%E7%89%88-blue.svg" alt="中文文档"></a>
55
- <a href="https://dl.circleci.com/status-badge/redirect/gh/Haixing-Hu/js-json/tree/master"><img src="https://dl.circleci.com/status-badge/img/gh/Haixing-Hu/js-json/tree/master.svg?style=shield" alt="CircleCI"></a>
56
- <a href="https://coveralls.io/github/Haixing-Hu/js-json?branch=master"><img src="https://coveralls.io/repos/github/Haixing-Hu/js-json/badge.svg?branch=master" alt="Coverage Status"></a></p>
57
- <p><a href="https://npmjs.com/package/@qubit-ltd/json">@qubit-ltd/json</a> is a JavaScript library that extends the functionality of the
58
- standard JSON object, providing robust support for working with numbers that
59
- exceed JavaScript's safe range. It offers enhanced parsing and stringifying
60
- capabilities, making it ideal for handling large datasets and complex numerical
61
- operations while adhering to JSON's structure.</p>
62
- <h2>Key Features</h2>
63
- <ul>
64
- <li><strong><code>BigInt</code> Support</strong>: When parsing JSON strings, numbers outside JavaScript's safe
65
- integer range are automatically converted to the native <code>BigInt</code>, ensuring
66
- precision is maintained.</li>
67
- <li><strong><code>LosslessNumber</code> Handling</strong>: For floating-point numbers that cannot be accurately
68
- represented in JavaScript, this library introduces the <code>LosslessNumber</code> object.
69
- This lightweight object preserves the full precision of the number as a string,
70
- allowing flexible conversion to number or <code>BigInt</code> for mathematical operations.</li>
71
- <li><strong>Accurate Stringification</strong>: During the stringify process, <code>BigInt</code> values are
72
- serialized as strings without the &quot;n&quot; suffix, maintaining compatibility with
73
- the standard JSON format. Similarly, <code>LosslessNumber</code> objects are serialized
74
- using their internal string representation.</li>
75
- <li><strong>Collection Serialization</strong>: JavaScript's native collections like <code>Set</code> and <code>Map</code>
76
- are seamlessly serialized as arrays, allowing for better compatibility with
77
- JSON structures.</li>
78
- </ul>
79
- <p>For more details on why JSON parsing can corrupt large numbers and how this
80
- library helps resolve the issue, refer to
81
- <a href="https://jsoneditoronline.org/indepth/parse/why-does-json-parse-corrupt-large-numbers/">Why does JSON.parse corrupt large numbers and how to solve this?</a>.</p>
82
- <h2>Installation</h2>
83
- <p>To install the library, use either npm or yarn:</p>
84
- <pre class="prettyprint source lang-sh"><code>npm install @qubit-ltd/json
85
- </code></pre>
86
- <p>or</p>
87
- <pre class="prettyprint source lang-sh"><code>yarn add @qubit-ltd/json
88
- </code></pre>
89
- <h2>Core Functionality</h2>
90
- <h3>JSON-like Object</h3>
91
- <p>The library provides an object similar to the standard JSON object, but with
92
- enhanced capabilities for handling large integers, floating-point numbers, and
93
- collections like Set and Map.</p>
94
- <pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
95
-
96
- // Parse numbers outside the safe range
7
+ // 解析超出安全范围的数字
97
8
  const str1 = '{&quot;decimal&quot;:2.370,&quot;big_int&quot;:9123372036854000123,&quot;big_float&quot;:2.3e+500}';
98
9
  const obj1 = Json.parse(str1);
99
10
  console.log(obj1.decimal); // 2.37
@@ -101,11 +12,11 @@ console.log(obj1.big_int); // 9123372036854000123n
101
12
  console.log(obj1.big_float); // LosslessNumber { value: '2.3e+500', isLosslessNumber: true }
102
13
  console.log(String(obj1.big_float)); // '2.3e+500'
103
14
 
104
- // Stringify numbers outside the safe range
15
+ // 序列化超出安全范围的数字
105
16
  const json1 = Json.stringify(obj1);
106
17
  console.log(json1); // '{&quot;decimal&quot;:2.37,&quot;big_int&quot;:9123372036854000123,&quot;big_float&quot;:&quot;2.3e+500&quot;}'
107
18
 
108
- // Stringify collections
19
+ // 序列化集合类型
109
20
  const obj2 = {
110
21
  x: new Set([{ a: 1 }, { b: 2 }, { c: 3 }]),
111
22
  y: new Map([[1, { a: 2 }], [2, { b: 4 }]]),
@@ -113,10 +24,10 @@ const obj2 = {
113
24
  const json2 = Json.stringify(obj2);
114
25
  console.log(json2); // '{&quot;x&quot;:[{&quot;a&quot;:1},{&quot;b&quot;:2},{&quot;c&quot;:3}],&quot;y&quot;:[[1,{&quot;a&quot;:2}],[2,{&quot;b&quot;:4}]]}'
115
26
 
116
- // Pretty-print with indentation
27
+ // 格式化输出(带缩进)
117
28
  const json3 = Json.stringify(obj2, null, 2);
118
29
  console.log(json3);
119
- /* Output:
30
+ /* 输出:
120
31
  {
121
32
  &quot;x&quot;: [
122
33
  {
@@ -145,147 +56,106 @@ console.log(json3);
145
56
  ]
146
57
  }
147
58
  */
148
- </code></pre>
149
- <h3>LosslessNumber Class</h3>
150
- <p>The <code>LosslessNumber</code> class is used to handle floating-point numbers with full
151
- precision, avoiding truncation or rounding issues.</p>
152
- <pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
59
+ </code></pre><h3>LosslessNumber 类</h3><p><code>LosslessNumber</code> 类用于处理具有完整精度的浮点数,避免截断或舍入问题。</p><pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
153
60
  import { LosslessNumber } from '@qubit-ltd/json';
154
61
 
155
- // Parse a number with high precision
62
+ // 解析高精度数字
156
63
  const parsed = Json.parse('{&quot;float&quot;: 1.234567891234567891234}');
157
64
  console.log(parsed.float); // LosslessNumber { value: '1.234567891234567891234' }
158
65
 
159
- // Convert LosslessNumber to standard number
160
- console.log(parsed.float.valueOf()); // 1.2345678912345679 (standard JS number, precision loss)
66
+ // LosslessNumber 转换为标准数字
67
+ console.log(parsed.float.valueOf()); // 1.2345678912345679(标准 JS 数字,有精度损失)
161
68
 
162
- // Create a LosslessNumber directly
69
+ // 直接创建 LosslessNumber
163
70
  const largeNumber = new LosslessNumber('9876543210.123456789012345678901234567890');
164
71
  console.log(largeNumber.toString()); // '9876543210.123456789012345678901234567890'
165
- console.log(largeNumber.valueOf()); // 9876543210.123457 (standard JS number with precision loss)
72
+ console.log(largeNumber.valueOf()); // 9876543210.123457(标准 JS 数字,有精度损失)
166
73
 
167
- // Mathematical operations
74
+ // 数学运算
168
75
  const num1 = new LosslessNumber('1234567890.123456789');
169
76
  const num2 = 100;
170
- // For math operations, LosslessNumber is converted to standard number (with potential precision loss)
77
+ // 对于数学运算,LosslessNumber 会转换为标准数字(可能有精度损失)
171
78
  console.log(num1 * num2); // 123456789012.34578
172
- </code></pre>
173
- <h3>Utility Functions</h3>
174
- <p>This library provides a set of utility functions to aid in the handling of large
175
- numbers and ensure safe conversions.</p>
176
- <h4><code>isBigInt(value)</code></h4>
177
- <p>Checks if a string represents a <code>BigInt</code> (i.e., ends with an &quot;n&quot; suffix).</p>
178
- <pre class="prettyprint source lang-javascript"><code>import { isBigInt } from '@qubit-ltd/json';
79
+ </code></pre><h3>实用函数</h3><p>该库提供了一组实用函数,用于处理大数字并确保安全转换。</p><h4><code>isBigInt(value)</code></h4><p>检查一个字符串是否表示 <code>BigInt</code>(即是否以 &quot;n&quot; 结尾)。</p><pre class="prettyprint source lang-javascript"><code>import { isBigInt } from '@qubit-ltd/json';
179
80
 
180
81
  console.log(isBigInt('12345n')); // true
181
82
  console.log(isBigInt('12345')); // false
182
- </code></pre>
183
- <h4><code>isInteger(value)</code></h4>
184
- <p>Checks if a string represents an integer.</p>
185
- <pre class="prettyprint source lang-javascript"><code>import { isInteger } from '@qubit-ltd/json';
83
+ </code></pre><h4><code>isInteger(value)</code></h4><p>检查一个字符串是否表示整数。</p><pre class="prettyprint source lang-javascript"><code>import { isInteger } from '@qubit-ltd/json';
186
84
 
187
85
  console.log(isInteger('12345')); // true
188
86
  console.log(isInteger('123.45')); // false
189
- console.log(isInteger('123e5')); // true (12300000 is an integer)
190
- console.log(isInteger('123e-5')); // false (0.00123 is not an integer)
191
- </code></pre>
192
- <h4><code>isNumber(value)</code></h4>
193
- <p>Checks if a string represents a number.</p>
194
- <pre class="prettyprint source lang-javascript"><code>import { isNumber } from '@qubit-ltd/json';
87
+ console.log(isInteger('123e5')); // true12300000 是整数)
88
+ console.log(isInteger('123e-5')); // false0.00123 不是整数)
89
+ </code></pre><h4><code>isNumber(value)</code></h4><p>检查一个字符串是否表示数字。</p><pre class="prettyprint source lang-javascript"><code>import { isNumber } from '@qubit-ltd/json';
195
90
 
196
91
  console.log(isNumber('12345')); // true
197
92
  console.log(isNumber('-123.45')); // true
198
93
  console.log(isNumber('1.23e-11')); // true
199
94
  console.log(isNumber('abc')); // false
200
95
  console.log(isNumber('123abc')); // false
201
- console.log(isNumber('0xFF')); // false (hexadecimal notation not supported)
202
- </code></pre>
203
- <h4><code>isSafeNumber(value, options)</code></h4>
204
- <p>Checks if a string represents a number within JavaScript's safe range.</p>
205
- <pre class="prettyprint source lang-javascript"><code>import { isSafeNumber } from '@qubit-ltd/json';
96
+ console.log(isNumber('0xFF')); // false(不支持十六进制表示法)
97
+ </code></pre><h4><code>isSafeNumber(value, options)</code></h4><p>检查一个字符串是否表示在 JavaScript 安全范围内的数字。</p><pre class="prettyprint source lang-javascript"><code>import { isSafeNumber } from '@qubit-ltd/json';
206
98
 
207
99
  console.log(isSafeNumber('12345')); // true
208
- console.log(isSafeNumber('12345678901234567890')); // false (too large for JavaScript's number type)
209
- console.log(isSafeNumber('123.45678901234567890')); // false (too many significant digits)
100
+ console.log(isSafeNumber('12345678901234567890')); // false(对于 JavaScript 的数字类型来说太大)
101
+ console.log(isSafeNumber('123.45678901234567890')); // false(有效数字太多)
210
102
 
211
- // With options
103
+ // 使用选项
212
104
  console.log(isSafeNumber('123.45678901234567890', {
213
- approx: true, // Allow approximate representation
214
- requiredDigits: 16 // Require at least 16 digits of precision
105
+ approx: true, // 允许近似表示
106
+ requiredDigits: 16 // 要求至少保留 16 位有效数字精度
215
107
  })); // true
216
- </code></pre>
217
- <h4><code>getUnsafeReason(value)</code></h4>
218
- <p>Explains why a number represented by a string is unsafe, returning one of the
219
- following reasons:</p>
220
- <ul>
221
- <li><code>'overflow'</code>: The number is too large to be represented in JavaScript</li>
222
- <li><code>'underflow'</code>: The number is too small to be represented in JavaScript</li>
223
- <li><code>'truncate_integer'</code>: The integer part would be truncated if converted to a JavaScript number</li>
224
- <li><code>'truncate_float'</code>: The floating-point part would lose precision if converted to a JavaScript number</li>
225
- <li><code>'none'</code>: The value is safe to convert to a JavaScript number</li>
226
- </ul>
227
- <pre class="prettyprint source lang-javascript"><code>import { getUnsafeReason } from '@qubit-ltd/json';
108
+ </code></pre><h4><code>getUnsafeReason(value)</code></h4><p>解释为什么由字符串表示的数字不安全,返回以下原因之一:</p><ul><li><code>'overflow'</code>(溢出):数字太大,超出了 JavaScript 可表示的范围</li><li><code>'underflow'</code>(下溢):数字太小,低于 JavaScript 可表示的范围</li><li><code>'truncate_integer'</code>(整数截断):如果转换为 JavaScript 数字,整数部分会被截断</li><li><code>'truncate_float'</code>(浮点数截断):如果转换为 JavaScript 数字,浮点部分会失去精度</li><li><code>'none'</code>:值是安全的,可以安全地转换为 JavaScript 数字</li></ul><pre class="prettyprint source lang-javascript"><code>import { getUnsafeReason } from '@qubit-ltd/json';
228
109
 
229
- console.log(getUnsafeReason('12345')); // Output: 'none'
230
- console.log(getUnsafeReason('12345678901234567890')); // Output: 'truncate_integer'
231
- console.log(getUnsafeReason('-12345678901234567890.123')); // Output: 'truncate_float'
232
- console.log(getUnsafeReason('-1e+1000')); // Output: 'overflow'
233
- console.log(getUnsafeReason('1e-324')); // Output: 'underflow'
234
- </code></pre>
235
- <h4><code>toSafeNumberOrThrow(value, options)</code></h4>
236
- <p>Converts a string into a number if it is safe to do so. Throws an error if the
237
- number is unsafe, explaining the reason. This is useful for validating numeric inputs.</p>
238
- <pre class="prettyprint source lang-javascript"><code>import { toSafeNumberOrThrow } from '@qubit-ltd/json';
110
+ console.log(getUnsafeReason('12345')); // 输出: 'none'
111
+ console.log(getUnsafeReason('12345678901234567890')); // 输出: 'truncate_integer'
112
+ console.log(getUnsafeReason('-12345678901234567890.123')); // 输出: 'truncate_float'
113
+ console.log(getUnsafeReason('-1e+1000')); // 输出: 'overflow'
114
+ console.log(getUnsafeReason('1e-324')); // 输出: 'underflow'
115
+ </code></pre><h4><code>toSafeNumberOrThrow(value, options)</code></h4><p>如果可以安全转换,将字符串转换为数字。如果数字不安全,则抛出错误并解释原因。这对于验证数字输入非常有用。</p><pre class="prettyprint source lang-javascript"><code>import { toSafeNumberOrThrow } from '@qubit-ltd/json';
239
116
 
240
117
  try {
241
118
  console.log(toSafeNumberOrThrow('-12345678901234567890'));
242
119
  } catch (e) {
243
- console.error(e.message); // Output: 'Cannot safely convert to number: the value '-12345678901234567890' would truncate integer and become -12345678901234567000'
120
+ console.error(e.message); // 输出: 'Cannot safely convert to number: the value '-12345678901234567890' would truncate integer and become -12345678901234567000'
244
121
  }
245
122
 
246
- // Safe conversion example
247
- console.log(toSafeNumberOrThrow('9007199254740991')); // Output: 9007199254740991
123
+ // 安全转换示例
124
+ console.log(toSafeNumberOrThrow('9007199254740991')); // 输出: 9007199254740991
248
125
 
249
- // With options
126
+ // 使用选项
250
127
  try {
251
128
  console.log(toSafeNumberOrThrow('123.45678901234567890', {
252
- approx: false, // Do not allow approximate representation
253
- requiredDigits: 20 // Require at least 20 digits of precision
129
+ approx: false, // 不允许近似表示
130
+ requiredDigits: 20 // 要求至少保留 20 位有效数字精度
254
131
  }));
255
132
  } catch (e) {
256
- console.error(e.message); // Will throw error about precision loss
133
+ console.error(e.message); // 将抛出关于精度损失的错误
257
134
  }
258
- </code></pre>
259
- <h2>Advanced Usage</h2>
260
- <h3>Custom Parsing Options</h3>
261
- <p>You can customize how numbers are parsed using options:</p>
262
- <pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
135
+ </code></pre><h2>高级用法</h2><h3>自定义解析选项</h3><p>您可以使用选项自定义数字的解析方式:</p><pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
263
136
 
264
137
  const json = '{&quot;bigInt&quot;: 9007199254740993, &quot;largeFloat&quot;: 1.234567890123456789}';
265
138
 
266
- // Use custom parsing options
139
+ // 使用自定义解析选项
267
140
  const result = Json.parse(json, {
268
- useBigInt: true, // Default is true - convert large integers to BigInt
269
- losslessNumbers: true, // Default is true - use LosslessNumber for high-precision floats
141
+ useBigInt: true, // 默认为 true - 将大整数转换为 BigInt
142
+ losslessNumbers: true, // 默认为 true - 为高精度浮点数使用 LosslessNumber
270
143
  });
271
144
 
272
145
  console.log(typeof result.bigInt); // 'bigint'
273
146
  console.log(result.bigInt); // 9007199254740993n
274
147
  console.log(result.largeFloat); // LosslessNumber { value: '1.234567890123456789' }
275
148
 
276
- // Disable custom number handling
149
+ // 禁用自定义数字处理
277
150
  const standardResult = Json.parse(json, {
278
151
  useBigInt: false,
279
152
  losslessNumbers: false,
280
153
  });
281
154
 
282
155
  console.log(typeof standardResult.bigInt); // 'number'
283
- console.log(standardResult.bigInt); // 9007199254740992 (precision loss!)
284
- console.log(standardResult.largeFloat); // 1.2345678901234568 (precision loss!)
285
- </code></pre>
286
- <h3>Custom Stringification Options</h3>
287
- <p>You can customize how values are stringified:</p>
288
- <pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
156
+ console.log(standardResult.bigInt); // 9007199254740992(精度损失!)
157
+ console.log(standardResult.largeFloat); // 1.2345678901234568(精度损失!)
158
+ </code></pre><h3>自定义字符串化选项</h3><p>您可以自定义值的字符串化方式:</p><pre class="prettyprint source lang-javascript"><code>import Json from '@qubit-ltd/json';
289
159
 
290
160
  const data = {
291
161
  bigInt: BigInt('9007199254740993'),
@@ -294,13 +164,13 @@ const data = {
294
164
  map: new Map([['a', 1], ['b', 2]]),
295
165
  };
296
166
 
297
- // Default stringification (handles BigInt, LosslessNumber, Set, Map)
167
+ // 默认字符串化(处理 BigIntLosslessNumberSetMap
298
168
  console.log(Json.stringify(data));
299
169
  // '{&quot;bigInt&quot;:9007199254740993,&quot;largeFloat&quot;:&quot;1.234567890123456789&quot;,&quot;set&quot;:[1,2,3],&quot;map&quot;:[[&quot;a&quot;,1],[&quot;b&quot;,2]]}'
300
170
 
301
- // With custom options and indentation
171
+ // 使用自定义选项和缩进
302
172
  console.log(Json.stringify(data, null, 2));
303
- /* Output:
173
+ /* 输出:
304
174
  {
305
175
  &quot;bigInt&quot;: 9007199254740993,
306
176
  &quot;largeFloat&quot;: &quot;1.234567890123456789&quot;,
@@ -321,83 +191,12 @@ console.log(Json.stringify(data, null, 2));
321
191
  ]
322
192
  }
323
193
  */
324
- </code></pre>
325
- <h2><span id="contributing">Contributing</span></h2>
326
- <p>If you find any issues or have suggestions for improvements, please feel free
327
- to open an issue or submit a pull request to the <a href="https://github.com/Haixing-Hu/js-json">GitHub repository</a>.</p>
328
- <h3>Development Setup</h3>
329
- <ol>
330
- <li>
331
- <p>Clone the repository:</p>
332
- <pre class="prettyprint source lang-sh"><code>git clone https://github.com/Haixing-Hu/js-json.git
194
+ </code></pre><h2><span id="contributing">贡献</span></h2><p>如果您发现任何问题或有改进建议,请随时在 <a href="https://github.com/Haixing-Hu/js-json">GitHub 仓库</a> 上提交 issue 或 pull request。</p><h3>开发设置</h3><ol><li><p>克隆仓库:</p><pre class="prettyprint source lang-sh"><code>git clone https://github.com/Haixing-Hu/js-json.git
333
195
  cd js-json
334
- </code></pre>
335
- </li>
336
- <li>
337
- <p>Install dependencies:</p>
338
- <pre class="prettyprint source lang-sh"><code>yarn install
339
- </code></pre>
340
- </li>
341
- <li>
342
- <p>Run tests:</p>
343
- <pre class="prettyprint source lang-sh"><code>yarn test
344
- </code></pre>
345
- </li>
346
- <li>
347
- <p>Build the library:</p>
348
- <pre class="prettyprint source lang-sh"><code>yarn build
349
- </code></pre>
350
- </li>
351
- </ol>
352
- <h3>Release Process</h3>
353
- <ol>
354
- <li>Update version in package.json</li>
355
- <li>Run tests and linting:<pre class="prettyprint source lang-sh"><code>yarn lint && yarn test
356
- </code></pre>
357
- </li>
358
- <li>Build the library:<pre class="prettyprint source lang-sh"><code>yarn build:all
359
- </code></pre>
360
- </li>
361
- <li>Publish to npm:<pre class="prettyprint source lang-sh"><code>yarn deploy
362
- </code></pre>
363
- </li>
364
- </ol>
365
- <h2><span id="license">License</span></h2>
366
- <p><a href="https://npmjs.com/package/@qubit-ltd/json">@qubit-ltd/json</a> is distributed under the Apache 2.0 license.
367
- See the <a href="LICENSE">LICENSE</a> file for more details.</p>
368
- <h2><span id="acknowledgements">Acknowledgements</span></h2>
369
- <p>This project builds upon and incorporates code from several open-source libraries
370
- that have made significant contributions to handling large numbers and custom
371
- parsing in JSON. We would like to acknowledge and thank the authors of the
372
- following projects:</p>
373
- <ul>
374
- <li><a href="https://github.com/sidorares/json-bigint">json-bigint</a>: Provides support for parsing and stringifying JSON with BigInt,
375
- allowing for precise handling of large numbers.</li>
376
- <li><a href="https://github.com/josdejong/lossless-json">lossless-json</a>: A library that offers lossless handling of numbers in JSON,
377
- ensuring full precision when dealing with floating-point values.</li>
378
- <li><a href="https://github.com/jawj/json-custom-numbers">json-custom-numbers</a>: Allows for custom handling of numbers in JSON parsing
379
- and stringifying, offering flexibility in numerical representation.</li>
380
- </ul>
381
- <p>We are grateful for the work of these contributors, which has been instrumental
382
- in shaping the functionality of this library.</p></article>
383
- </section>
384
-
385
-
386
-
387
-
388
-
389
-
390
- </div>
391
-
392
- <br class="clear">
393
-
394
- <footer>
395
- Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
396
- on Wed Apr 16 2025 18:02:33 GMT+0800 (China Standard Time)
397
- using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
398
- </footer>
399
-
400
- <script>prettyPrint();</script>
401
- <script src="scripts/linenumber.js"></script>
402
- </body>
403
- </html>
196
+ </code></pre></li><li><p>安装依赖:</p><pre class="prettyprint source lang-sh"><code>yarn install
197
+ </code></pre></li><li><p>运行测试:</p><pre class="prettyprint source lang-sh"><code>yarn test
198
+ </code></pre></li><li><p>构建库:</p><pre class="prettyprint source lang-sh"><code>yarn build
199
+ </code></pre></li></ol><h3>发布流程</h3><ol><li>更新 package.json 中的版本号</li><li>运行测试和 lint 检查:<pre class="prettyprint source lang-sh"><code>yarn lint && yarn test
200
+ </code></pre></li><li>构建库:<pre class="prettyprint source lang-sh"><code>yarn build:all
201
+ </code></pre></li><li>发布到 npm:<pre class="prettyprint source lang-sh"><code>yarn deploy
202
+ </code></pre></li></ol><h2><span id="license">许可证</span></h2><p><a href="https://npmjs.com/package/@qubit-ltd/json">@qubit-ltd/json</a> 根据 Apache 2.0 许可证分发。详情请参阅 <a href="LICENSE">LICENSE</a> 文件。</p><h2><span id="acknowledgements">致谢</span></h2><p>该项目基于并集成了多个开源库的代码,这些库在处理大数字和自定义 JSON 解析方面做出了重要贡献。我们想特别感谢以下项目的作者:</p><ul><li><a href="https://github.com/sidorares/json-bigint">json-bigint</a>:提供对使用 BigInt 解析和字符串化 JSON 的支持,使得可以精确处理大数字。</li><li><a href="https://github.com/josdejong/lossless-json">lossless-json</a>:一个确保在处理浮点数时保持完全精度的库,提供无损的 JSON 数字处理。</li><li><a href="https://github.com/jawj/json-custom-numbers">json-custom-numbers</a>:允许在 JSON 解析和字符串化过程中自定义数字处理,提供灵活的数值表示。</li></ul><p>我们对这些贡献者的工作表示感谢,这些工作对本库功能的实现起到了至关重要的作用。</p></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="LosslessNumber.html">LosslessNumber</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#getUnsafeReason">getUnsafeReason</a></div><div class="sidebar-section-children"><a href="global.html#isBigInt">isBigInt</a></div><div class="sidebar-section-children"><a href="global.html#isInteger">isInteger</a></div><div class="sidebar-section-children"><a href="global.html#isNumber">isNumber</a></div><div class="sidebar-section-children"><a href="global.html#isSafeNumber">isSafeNumber</a></div><div class="sidebar-section-children"><a href="global.html#json">json</a></div><div class="sidebar-section-children"><a href="global.html#toSafeNumberOrThrow">toSafeNumberOrThrow</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>