@syzlm/function 1.0.0 → 1.0.1
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/dist/arrays/arrayUtils.d.ts +13 -1
- package/dist/arrays/arrayUtils.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/objects/objectUtils.d.ts +7 -0
- package/dist/objects/objectUtils.d.ts.map +1 -1
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/storage.d.ts +13 -0
- package/dist/storage/storage.d.ts.map +1 -0
- package/dist/strings/stringUtils.d.ts.map +1 -1
- package/docs/README.md +32 -0
- package/docs/functions/capitalize.md +27 -0
- package/docs/functions/chunk.md +39 -0
- package/docs/functions/clamp.md +39 -0
- package/docs/functions/debounce.md +49 -0
- package/docs/functions/deepClone.md +33 -0
- package/docs/functions/delay.md +27 -0
- package/docs/functions/get.md +39 -0
- package/docs/functions/getFontLength.md +27 -0
- package/docs/functions/getFontWidth.md +33 -0
- package/docs/functions/isPlainObject.md +27 -0
- package/docs/functions/merge.md +39 -0
- package/docs/functions/parseStrEmpty.md +27 -0
- package/docs/functions/randomString.md +27 -0
- package/docs/functions/range.md +39 -0
- package/docs/functions/round.md +33 -0
- package/docs/functions/set.md +45 -0
- package/docs/functions/shuffle.md +33 -0
- package/docs/functions/simpleUnique.md +40 -0
- package/docs/functions/thousandSign.md +27 -0
- package/docs/functions/thousandSignZero.md +33 -0
- package/docs/functions/throttle.md +49 -0
- package/docs/functions/toCamelCase.md +27 -0
- package/docs/functions/toFixed.md +33 -0
- package/docs/functions/unique.md +39 -0
- package/package.json +22 -4
- package/src/arrays/arrayUtils.ts +33 -3
- package/src/arrays/index.ts +1 -1
- package/src/numbers/index.ts +1 -1
- package/src/numbers/numberUtils.ts +7 -7
- package/src/objects/index.ts +1 -1
- package/src/objects/objectUtils.ts +18 -13
- package/src/storage/storage.ts +5 -4
- package/src/strings/index.ts +1 -1
- package/src/strings/stringUtils.ts +11 -9
- package/src/utils/index.ts +1 -1
- package/src/utils/utilFunctions.ts +3 -3
- package/README.md +0 -111
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -85
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1633
- package/docs/functions/capitalize.html +0 -4
- package/docs/functions/chunk.html +0 -5
- package/docs/functions/clamp.html +0 -6
- package/docs/functions/debounce.html +0 -5
- package/docs/functions/deepClone.html +0 -4
- package/docs/functions/delay.html +0 -4
- package/docs/functions/get.html +0 -6
- package/docs/functions/getFontLength.html +0 -4
- package/docs/functions/getFontWidth.html +0 -5
- package/docs/functions/isPlainObject.html +0 -4
- package/docs/functions/merge.html +0 -5
- package/docs/functions/parseStrEmpty.html +0 -4
- package/docs/functions/randomString.html +0 -4
- package/docs/functions/range.html +0 -6
- package/docs/functions/round.html +0 -5
- package/docs/functions/set.html +0 -6
- package/docs/functions/shuffle.html +0 -4
- package/docs/functions/thousandSign.html +0 -4
- package/docs/functions/thousandSignZero.html +0 -5
- package/docs/functions/throttle.html +0 -5
- package/docs/functions/toCamelCase.html +0 -4
- package/docs/functions/toFixed.html +0 -5
- package/docs/functions/unique.html +0 -4
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -53
- package/docs/modules.html +0 -1
- package/jest.config.js +0 -8
- package/rollup.config.js +0 -29
- package/scripts/deploy-docs.sh +0 -40
- package/test-output.txt +0 -23
- package/test-tofixed.js +0 -36
- package/tests/arrays.test.ts +0 -89
- package/tests/numbers.test.ts +0 -140
- package/tests/objects.test.ts +0 -189
- package/tests/strings.test.ts +0 -197
- package/tests/utils.test.ts +0 -121
- package/tsconfig.json +0 -21
- package/typedoc.json +0 -15
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>thousandSignZero | Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">thousandSignZero</a></li></ul><h1>Function thousandSignZero</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="thousandsignzero"><span class="tsd-kind-call-signature">thousandSignZero</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">num</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">fixed</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#thousandsignzero" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>千分位格式化 自动补零</p>
|
|
2
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">num</span>: <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>需要格式化的数字或字符串</p>
|
|
3
|
-
</div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">fixed</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>保留的小数位数,默认2位</p>
|
|
4
|
-
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>千分位格式化后的字符串</p>
|
|
5
|
-
<aside class="tsd-sources"><ul><li>Defined in strings/stringUtils.ts:108</li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="../modules.html">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>throttle | Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">throttle</a></li></ul><h1>Function throttle</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="throttle"><span class="tsd-kind-call-signature">throttle</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#throttlet">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">func</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#throttlet">T</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">limit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#throttlet">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span><a href="#throttle" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>节流函数</p>
|
|
2
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="throttlet"><span class="tsd-kind-type-parameter">T</span> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">any</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">func</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#throttlet">T</a></span><div class="tsd-comment tsd-typography"><p>需要节流的函数</p>
|
|
3
|
-
</div></li><li><span><span class="tsd-kind-parameter">limit</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>限制时间(毫秒)</p>
|
|
4
|
-
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#throttlet">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></h4><p>节流后的函数</p>
|
|
5
|
-
<aside class="tsd-sources"><ul><li>Defined in utils/utilFunctions.ts:24</li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="../modules.html">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>toCamelCase | Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">toCamelCase</a></li></ul><h1>Function toCamelCase</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="tocamelcase"><span class="tsd-kind-call-signature">toCamelCase</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">str</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#tocamelcase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>字符串驼峰命名转换函数</p>
|
|
2
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">str</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>需要转换的字符串</p>
|
|
3
|
-
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>驼峰命名的字符串</p>
|
|
4
|
-
<aside class="tsd-sources"><ul><li>Defined in strings/stringUtils.ts:10</li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="../modules.html">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>toFixed | Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">toFixed</a></li></ul><h1>Function toFixed</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="tofixed"><span class="tsd-kind-call-signature">toFixed</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">num</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">digits</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#tofixed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>精确的数字toFixed函数</p>
|
|
2
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">num</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>需要处理的数字</p>
|
|
3
|
-
</div></li><li><span><span class="tsd-kind-parameter">digits</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0</span></span><div class="tsd-comment tsd-typography"><p>保留小数位数</p>
|
|
4
|
-
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>格式化后的字符串</p>
|
|
5
|
-
<aside class="tsd-sources"><ul><li>Defined in numbers/numberUtils.ts:44</li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="../modules.html">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>unique | Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">unique</a></li></ul><h1>Function unique</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="unique"><span class="tsd-kind-call-signature">unique</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#uniquet">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">arr</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#uniquet">T</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#uniquet">T</a><span class="tsd-signature-symbol">[]</span><a href="#unique" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>数组去重函数</p>
|
|
2
|
-
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="uniquet"><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">arr</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#uniquet">T</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>需要去重的数组</p>
|
|
3
|
-
</div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="#uniquet">T</a><span class="tsd-signature-symbol">[]</span></h4><p>去重后的新数组</p>
|
|
4
|
-
<aside class="tsd-sources"><ul><li>Defined in arrays/arrayUtils.ts:6</li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="../modules.html">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/docs/hierarchy.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="./"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h1>Function - TypeScript 工具函数库 - v1.0.0</h1></div><h2>Hierarchy Summary</h2></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="modules.html">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/docs/index.html
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="./"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h1>Function - TypeScript 工具函数库 - v1.0.0</h1></div><div class="tsd-panel tsd-typography"><h1 id="function-typescript-工具函数库" class="tsd-anchor-link">Function - TypeScript 工具函数库<a href="#function-typescript-工具函数库" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>一个轻量级、高性能的 TypeScript 工具函数库,支持按需加载,适合现代前端和 Node.js 项目使用。</p>
|
|
2
|
-
<h2 id="特性" class="tsd-anchor-link">特性<a href="#特性" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|
|
3
|
-
<li>✨ <strong>TypeScript 编写</strong>:完整的类型定义,提供良好的开发体验</li>
|
|
4
|
-
<li>📦 <strong>按需加载</strong>:支持 ES 模块,可通过 Tree Shaking 优化打包体积</li>
|
|
5
|
-
<li>🔧 <strong>丰富的工具函数</strong>:涵盖数组、对象、字符串、数字和通用工具</li>
|
|
6
|
-
<li>🚀 <strong>高性能</strong>:优化的实现,确保函数执行效率</li>
|
|
7
|
-
<li>📝 <strong>完善的文档</strong>:详细的 API 文档和使用示例</li>
|
|
8
|
-
</ul>
|
|
9
|
-
<h2 id="安装" class="tsd-anchor-link">安装<a href="#安装" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><span class="hl-1"> </span><span class="hl-2">function</span>
|
|
10
|
-
</code><button type="button">Copy</button></pre>
|
|
11
|
-
|
|
12
|
-
<h2 id="使用" class="tsd-anchor-link">使用<a href="#使用" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><h3 id="整体导入" class="tsd-anchor-link">整体导入<a href="#整体导入" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> </span><span class="hl-4">*</span><span class="hl-1"> </span><span class="hl-3">as</span><span class="hl-1"> </span><span class="hl-5">utils</span><span class="hl-1"> </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'function'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// 使用数组工具函数</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-7">uniqueArray</span><span class="hl-1"> = </span><span class="hl-5">utils</span><span class="hl-1">.</span><span class="hl-0">unique</span><span class="hl-1">([</span><span class="hl-8">1</span><span class="hl-1">, </span><span class="hl-8">2</span><span class="hl-1">, </span><span class="hl-8">2</span><span class="hl-1">, </span><span class="hl-8">3</span><span class="hl-1">]);</span><br/><br/><span class="hl-6">// 使用对象工具函数</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-7">clonedObj</span><span class="hl-1"> = </span><span class="hl-5">utils</span><span class="hl-1">.</span><span class="hl-0">deepClone</span><span class="hl-1">({ </span><span class="hl-5">a:</span><span class="hl-1"> </span><span class="hl-8">1</span><span class="hl-1">, </span><span class="hl-5">b:</span><span class="hl-1"> { </span><span class="hl-5">c:</span><span class="hl-1"> </span><span class="hl-8">2</span><span class="hl-1"> } });</span>
|
|
13
|
-
</code><button type="button">Copy</button></pre>
|
|
14
|
-
|
|
15
|
-
<h3 id="按需导入" class="tsd-anchor-link">按需导入<a href="#按需导入" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="typescript"><span class="hl-6">// 导入数组工具函数</span><br/><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-5">unique</span><span class="hl-1">, </span><span class="hl-5">shuffle</span><span class="hl-1">, </span><span class="hl-5">chunk</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'function/arrays'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// 导入对象工具函数</span><br/><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-5">deepClone</span><span class="hl-1">, </span><span class="hl-5">merge</span><span class="hl-1">, </span><span class="hl-5">get</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'function/objects'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// 导入字符串工具函数</span><br/><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-5">toCamelCase</span><span class="hl-1">, </span><span class="hl-5">capitalize</span><span class="hl-1">, </span><span class="hl-5">randomString</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'function/strings'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// 导入数字工具函数</span><br/><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-5">range</span><span class="hl-1">, </span><span class="hl-5">round</span><span class="hl-1">, </span><span class="hl-5">clamp</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'function/numbers'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// 导入通用工具函数</span><br/><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-5">debounce</span><span class="hl-1">, </span><span class="hl-5">throttle</span><span class="hl-1">, </span><span class="hl-5">delay</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'function/utils'</span><span class="hl-1">;</span>
|
|
16
|
-
</code><button type="button">Copy</button></pre>
|
|
17
|
-
|
|
18
|
-
<h2 id="api-文档" class="tsd-anchor-link">API 文档<a href="#api-文档" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><h3 id="数组工具函数" class="tsd-anchor-link">数组工具函数<a href="#数组工具函数" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
|
|
19
|
-
<li><code>unique<T>(arr: T[]): T[]</code> - 数组去重</li>
|
|
20
|
-
<li><code>shuffle<T>(arr: T[]): T[]</code> - 数组随机打乱</li>
|
|
21
|
-
<li><code>chunk<T>(arr: T[], size: number): T[][]</code> - 数组分块</li>
|
|
22
|
-
</ul>
|
|
23
|
-
<h3 id="对象工具函数" class="tsd-anchor-link">对象工具函数<a href="#对象工具函数" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
|
|
24
|
-
<li><code>deepClone<T extends object>(obj: T): T</code> - 对象深拷贝</li>
|
|
25
|
-
<li><code>merge<T extends object>(target: T, ...sources: Partial<T>[]): T</code> - 对象合并</li>
|
|
26
|
-
<li><code>get<T extends object>(obj: T, path: string, defaultValue?: any): any</code> - 获取对象属性值(支持路径访问)</li>
|
|
27
|
-
</ul>
|
|
28
|
-
<h3 id="字符串工具函数" class="tsd-anchor-link">字符串工具函数<a href="#字符串工具函数" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
|
|
29
|
-
<li><code>toCamelCase(str: string): string</code> - 字符串驼峰命名转换</li>
|
|
30
|
-
<li><code>capitalize(str: string): string</code> - 字符串首字母大写</li>
|
|
31
|
-
<li><code>randomString(length: number): string</code> - 生成随机字符串</li>
|
|
32
|
-
</ul>
|
|
33
|
-
<h3 id="数字工具函数" class="tsd-anchor-link">数字工具函数<a href="#数字工具函数" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
|
|
34
|
-
<li><code>range(start: number, end: number, step: number = 1): number[]</code> - 数字范围生成</li>
|
|
35
|
-
<li><code>round(num: number, decimals: number = 0): number</code> - 数字四舍五入</li>
|
|
36
|
-
<li><code>clamp(num: number, min: number, max: number): number</code> - 数字在指定范围内的限制</li>
|
|
37
|
-
</ul>
|
|
38
|
-
<h3 id="通用工具函数" class="tsd-anchor-link">通用工具函数<a href="#通用工具函数" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
|
|
39
|
-
<li><code>debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void</code> - 防抖函数</li>
|
|
40
|
-
<li><code>throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void</code> - 节流函数</li>
|
|
41
|
-
<li><code>delay(ms: number): Promise<void></code> - 延迟函数</li>
|
|
42
|
-
</ul>
|
|
43
|
-
<h2 id="构建" class="tsd-anchor-link">构建<a href="#构建" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-6"># 安装依赖</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><br/><br/><span class="hl-6"># 构建项目</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">run</span><span class="hl-1"> </span><span class="hl-2">build</span><br/><br/><span class="hl-6"># 监听模式构建</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">run</span><span class="hl-1"> </span><span class="hl-2">watch</span>
|
|
44
|
-
</code><button type="button">Copy</button></pre>
|
|
45
|
-
|
|
46
|
-
<h2 id="测试" class="tsd-anchor-link">测试<a href="#测试" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">test</span>
|
|
47
|
-
</code><button type="button">Copy</button></pre>
|
|
48
|
-
|
|
49
|
-
<h2 id="发布" class="tsd-anchor-link">发布<a href="#发布" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">publish</span>
|
|
50
|
-
</code><button type="button">Copy</button></pre>
|
|
51
|
-
|
|
52
|
-
<h2 id="许可证" class="tsd-anchor-link">许可证<a href="#许可证" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>ISC</p>
|
|
53
|
-
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#function-typescript-工具函数库"><span>Function -<wbr/> <wbr/>Type<wbr/>Script 工具函数库</span></a><ul><li><a href="#特性"><span>特性</span></a></li><li><a href="#安装"><span>安装</span></a></li><li><a href="#使用"><span>使用</span></a></li><li><ul><li><a href="#整体导入"><span>整体导入</span></a></li><li><a href="#按需导入"><span>按需导入</span></a></li></ul></li><li><a href="#api-文档"><span>API 文档</span></a></li><li><ul><li><a href="#数组工具函数"><span>数组工具函数</span></a></li><li><a href="#对象工具函数"><span>对象工具函数</span></a></li><li><a href="#字符串工具函数"><span>字符串工具函数</span></a></li><li><a href="#数字工具函数"><span>数字工具函数</span></a></li><li><a href="#通用工具函数"><span>通用工具函数</span></a></li></ul></li><li><a href="#构建"><span>构建</span></a></li><li><a href="#测试"><span>测试</span></a></li><li><a href="#发布"><span>发布</span></a></li><li><a href="#许可证"><span>许可证</span></a></li></ul></div></details></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="modules.html">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/docs/modules.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="./"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Function - TypeScript 工具函数库 - v1.0.0</title><meta name="description" content="Documentation for Function - TypeScript 工具函数库"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="index.html" class="title">Function - TypeScript 工具函数库 - v1.0.0</a><div id="tsd-toolbar-links"><a href="https://github.com/yourusername/function">GitHub</a></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"></ul><h1>Function - TypeScript 工具函数库 - v1.0.0</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Functions"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h2>Functions</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary" id="unique"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/unique.html">unique</a><a href="#unique" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="shuffle"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/shuffle.html">shuffle</a><a href="#shuffle" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="chunk"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/chunk.html">chunk</a><a href="#chunk" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="range"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/range.html">range</a><a href="#range" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="round"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/round.html">round</a><a href="#round" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="clamp"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/clamp.html">clamp</a><a href="#clamp" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="tofixed"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/toFixed.html">toFixed</a><a href="#tofixed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="deepclone"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/deepClone.html">deepClone</a><a href="#deepclone" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="merge"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/merge.html">merge</a><a href="#merge" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="get"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/get.html">get</a><a href="#get" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="set"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/set.html">set</a><a href="#set" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="isplainobject"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/isPlainObject.html">isPlainObject</a><a href="#isplainobject" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="tocamelcase"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/toCamelCase.html">toCamelCase</a><a href="#tocamelcase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="capitalize"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/capitalize.html">capitalize</a><a href="#capitalize" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="randomstring"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/randomString.html">randomString</a><a href="#randomstring" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="parsestrempty"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/parseStrEmpty.html">parseStrEmpty</a><a href="#parsestrempty" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="getfontlength"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/getFontLength.html">getFontLength</a><a href="#getfontlength" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="getfontwidth"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/getFontWidth.html">getFontWidth</a><a href="#getfontwidth" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="thousandsign"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/thousandSign.html">thousandSign</a><a href="#thousandsign" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="thousandsignzero"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/thousandSignZero.html">thousandSignZero</a><a href="#thousandsignzero" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="debounce"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/debounce.html">debounce</a><a href="#debounce" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="throttle"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/throttle.html">throttle</a><a href="#throttle" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary" id="delay"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><a href="functions/delay.html">delay</a><a href="#delay" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Functions"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Functions</summary><div><a href="#unique"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>unique</span></a><a href="#shuffle"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>shuffle</span></a><a href="#chunk"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>chunk</span></a><a href="#range"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>range</span></a><a href="#round"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>round</span></a><a href="#clamp"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>clamp</span></a><a href="#tofixed"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>to<wbr/>Fixed</span></a><a href="#deepclone"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>deep<wbr/>Clone</span></a><a href="#merge"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>merge</span></a><a href="#get"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>get</span></a><a href="#set"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>set</span></a><a href="#isplainobject"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>is<wbr/>Plain<wbr/>Object</span></a><a href="#tocamelcase"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>to<wbr/>Camel<wbr/>Case</span></a><a href="#capitalize"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>capitalize</span></a><a href="#randomstring"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>random<wbr/>String</span></a><a href="#parsestrempty"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>parse<wbr/>Str<wbr/>Empty</span></a><a href="#getfontlength"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>get<wbr/>Font<wbr/>Length</span></a><a href="#getfontwidth"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>get<wbr/>Font<wbr/>Width</span></a><a href="#thousandsign"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>thousand<wbr/>Sign</span></a><a href="#thousandsignzero"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>thousand<wbr/>Sign<wbr/>Zero</span></a><a href="#debounce"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>debounce</span></a><a href="#throttle"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>throttle</span></a><a href="#delay"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="assets/icons.svg#icon-64"></use></svg><span>delay</span></a></div></details></div></details></div><div class="site-menu"><nav id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/yourusername/function" class="tsd-nav-link">GitHub</a></nav><nav class="tsd-navigation"><a href="modules.html" class="current">Function - TypeScript 工具函数库 - v1.0.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/jest.config.js
DELETED
package/rollup.config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import typescript from '@rollup/plugin-typescript';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
4
|
-
import terser from '@rollup/plugin-terser';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
input: 'src/index.ts',
|
|
8
|
-
output: [
|
|
9
|
-
{
|
|
10
|
-
file: 'dist/index.js',
|
|
11
|
-
format: 'esm',
|
|
12
|
-
sourcemap: true,
|
|
13
|
-
exports: 'auto',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
file: 'dist/index.cjs.js',
|
|
17
|
-
format: 'cjs',
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
exports: 'auto',
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
plugins: [
|
|
23
|
-
resolve(),
|
|
24
|
-
commonjs(),
|
|
25
|
-
typescript({ declaration: false }), // 不生成类型定义
|
|
26
|
-
terser(),
|
|
27
|
-
],
|
|
28
|
-
external: [],
|
|
29
|
-
};
|
package/scripts/deploy-docs.sh
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# 部署文档到 GitHub Pages 的脚本
|
|
4
|
-
|
|
5
|
-
# 设置错误时退出
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
echo "开始构建 API 文档..."
|
|
9
|
-
|
|
10
|
-
# 构建文档
|
|
11
|
-
npm run docs
|
|
12
|
-
|
|
13
|
-
echo "文档构建完成!"
|
|
14
|
-
|
|
15
|
-
echo "开始部署文档到 GitHub Pages..."
|
|
16
|
-
|
|
17
|
-
# 进入文档目录
|
|
18
|
-
cd docs
|
|
19
|
-
|
|
20
|
-
# 初始化 Git 仓库(如果不存在)
|
|
21
|
-
if [ ! -d ".git" ]; then
|
|
22
|
-
git init
|
|
23
|
-
git config user.name "Deployment Bot"
|
|
24
|
-
git config user.email "deploy@example.com"
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
# 添加所有文件并提交
|
|
28
|
-
git add .
|
|
29
|
-
git commit -m "Deploy documentation"
|
|
30
|
-
|
|
31
|
-
# 推送到 GitHub Pages 分支(这里使用 gh-pages 分支)
|
|
32
|
-
# 注意:用户需要将 remote-url 替换为自己的 GitHub 仓库 URL
|
|
33
|
-
git push -f git@github.com:yourusername/function.git master:gh-pages
|
|
34
|
-
|
|
35
|
-
echo "文档部署完成!"
|
|
36
|
-
|
|
37
|
-
echo "API 文档已部署到:https://yourusername.github.io/function/"
|
|
38
|
-
|
|
39
|
-
# 返回项目根目录
|
|
40
|
-
cd ..
|
package/test-output.txt
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
-------------------|---------|----------|---------|---------|-------------------
|
|
2
|
-
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
3
|
-
-------------------|---------|----------|---------|---------|-------------------
|
|
4
|
-
All files | 22.07 | 25.61 | 9.52 | 22.59 |
|
|
5
|
-
src | 0 | 0 | 0 | 0 |
|
|
6
|
-
index.ts | 0 | 100 | 100 | 0 | 5-17
|
|
7
|
-
storage.ts | 0 | 0 | 0 | 0 | 6-82
|
|
8
|
-
src/arrays | 0 | 100 | 0 | 0 |
|
|
9
|
-
arrayUtils.ts | 0 | 100 | 0 | 0 | 6-35
|
|
10
|
-
index.ts | 0 | 100 | 100 | 0 | 2
|
|
11
|
-
src/numbers | 96.07 | 93.93 | 100 | 95.91 |
|
|
12
|
-
index.ts | 0 | 100 | 100 | 0 | 2
|
|
13
|
-
numberUtils.ts | 98 | 93.93 | 100 | 97.91 | 61
|
|
14
|
-
src/objects | 0 | 0 | 0 | 0 |
|
|
15
|
-
index.ts | 0 | 100 | 100 | 0 | 2
|
|
16
|
-
objectUtils.ts | 0 | 0 | 0 | 0 | 6-99
|
|
17
|
-
src/strings | 0 | 0 | 0 | 0 |
|
|
18
|
-
index.ts | 0 | 100 | 100 | 0 | 2
|
|
19
|
-
stringUtils.ts | 0 | 0 | 0 | 0 | 3-115
|
|
20
|
-
src/utils | 0 | 0 | 0 | 0 |
|
|
21
|
-
index.ts | 0 | 100 | 100 | 0 | 2
|
|
22
|
-
utilFunctions.ts | 0 | 0 | 0 | 0 | 7-44
|
|
23
|
-
-------------------|---------|----------|---------|---------|-------------------
|
package/test-tofixed.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// 测试精确的toFixed函数
|
|
2
|
-
const { toFixed } = require('./dist/index.js');
|
|
3
|
-
|
|
4
|
-
// 测试用例:原生toFixed有问题的小数
|
|
5
|
-
const testCases = [
|
|
6
|
-
0.1,
|
|
7
|
-
0.2,
|
|
8
|
-
0.1 + 0.2,
|
|
9
|
-
1.005,
|
|
10
|
-
2.56789,
|
|
11
|
-
-0.1,
|
|
12
|
-
-1.005,
|
|
13
|
-
1234.56789
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
console.log('测试精确的toFixed函数:');
|
|
17
|
-
console.log('====================================');
|
|
18
|
-
console.log('数字 | 原生toFixed(2) | 精确toFixed(2)');
|
|
19
|
-
console.log('====================================');
|
|
20
|
-
|
|
21
|
-
testCases.forEach(num => {
|
|
22
|
-
const nativeResult = num.toFixed(2);
|
|
23
|
-
const preciseResult = toFixed(num, 2);
|
|
24
|
-
console.log(`${num} | ${nativeResult} | ${preciseResult}`);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
console.log('====================================');
|
|
28
|
-
console.log('\n测试不同小数位数:');
|
|
29
|
-
console.log('====================================');
|
|
30
|
-
|
|
31
|
-
const num = 1.005;
|
|
32
|
-
for (let i = 1; i <= 5; i++) {
|
|
33
|
-
const nativeResult = num.toFixed(i);
|
|
34
|
-
const preciseResult = toFixed(num, i);
|
|
35
|
-
console.log(`toFixed(${i}) | 原生: ${nativeResult} | 精确: ${preciseResult}`);
|
|
36
|
-
}
|
package/tests/arrays.test.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { unique, shuffle, chunk } from '../src/arrays/arrayUtils';
|
|
2
|
-
|
|
3
|
-
describe('数组工具函数测试', () => {
|
|
4
|
-
describe('unique 函数', () => {
|
|
5
|
-
it('应该正确去重基本类型数组', () => {
|
|
6
|
-
expect(unique([1, 2, 2, 3, 4, 4, 5])).toEqual([1, 2, 3, 4, 5]);
|
|
7
|
-
expect(unique(['a', 'b', 'b', 'c'])).toEqual(['a', 'b', 'c']);
|
|
8
|
-
expect(unique([true, false, true])).toEqual([true, false]);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('应该正确处理空数组', () => {
|
|
12
|
-
expect(unique([])).toEqual([]);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('应该正确处理没有重复元素的数组', () => {
|
|
16
|
-
expect(unique([1, 2, 3, 4, 5])).toEqual([1, 2, 3, 4, 5]);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('应该正确处理包含多种类型元素的数组', () => {
|
|
20
|
-
const arr = [1, '1', 2, '2', true, false, true];
|
|
21
|
-
const result = unique(arr);
|
|
22
|
-
expect(result.length).toBe(6);
|
|
23
|
-
expect(result).toContain(1);
|
|
24
|
-
expect(result).toContain('1');
|
|
25
|
-
expect(result).toContain(2);
|
|
26
|
-
expect(result).toContain('2');
|
|
27
|
-
expect(result).toContain(true);
|
|
28
|
-
expect(result).toContain(false);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('shuffle 函数', () => {
|
|
33
|
-
it('应该随机打乱数组元素', () => {
|
|
34
|
-
const arr = [1, 2, 3, 4, 5];
|
|
35
|
-
const shuffled = shuffle(arr);
|
|
36
|
-
|
|
37
|
-
// 检查数组长度是否相同
|
|
38
|
-
expect(shuffled.length).toBe(arr.length);
|
|
39
|
-
|
|
40
|
-
// 检查所有元素是否都在
|
|
41
|
-
expect(shuffled).toEqual(expect.arrayContaining(arr));
|
|
42
|
-
|
|
43
|
-
// 检查顺序是否被打乱(虽然有极小概率顺序不变,但多次测试应该会通过)
|
|
44
|
-
const results = new Set();
|
|
45
|
-
for (let i = 0; i < 10; i++) {
|
|
46
|
-
results.add(JSON.stringify(shuffle(arr)));
|
|
47
|
-
}
|
|
48
|
-
expect(results.size).toBeGreaterThan(1);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('应该不修改原始数组', () => {
|
|
52
|
-
const arr = [1, 2, 3, 4, 5];
|
|
53
|
-
const original = [...arr];
|
|
54
|
-
shuffle(arr);
|
|
55
|
-
expect(arr).toEqual(original);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('应该正确处理空数组', () => {
|
|
59
|
-
expect(shuffle([])).toEqual([]);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('应该正确处理单元素数组', () => {
|
|
63
|
-
expect(shuffle([42])).toEqual([42]);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe('chunk 函数', () => {
|
|
68
|
-
it('应该正确将数组分块', () => {
|
|
69
|
-
expect(chunk([1, 2, 3, 4, 5, 6], 2)).toEqual([[1, 2], [3, 4], [5, 6]]);
|
|
70
|
-
expect(chunk([1, 2, 3, 4, 5], 2)).toEqual([[1, 2], [3, 4], [5]]);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('应该正确处理空数组', () => {
|
|
74
|
-
expect(chunk([], 2)).toEqual([]);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('应该正确处理数组长度正好是块大小的倍数', () => {
|
|
78
|
-
expect(chunk([1, 2, 3, 4, 5, 6], 3)).toEqual([[1, 2, 3], [4, 5, 6]]);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('应该正确处理块大小大于数组长度的情况', () => {
|
|
82
|
-
expect(chunk([1, 2, 3], 5)).toEqual([[1, 2, 3]]);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('应该正确处理块大小为1的情况', () => {
|
|
86
|
-
expect(chunk([1, 2, 3, 4, 5], 1)).toEqual([[1], [2], [3], [4], [5]]);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|