@nickyzj2023/utils 1.0.22 → 1.0.24
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/index.js +1 -1
- package/dist/is.d.ts +6 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/functions/camelToSnake.html +1 -1
- package/docs/functions/capitalize.html +1 -1
- package/docs/functions/decapitalize.html +1 -1
- package/docs/functions/fetcher.html +1 -1
- package/docs/functions/isFalsy.html +2 -2
- package/docs/functions/isNil.html +175 -0
- package/docs/functions/isObject.html +1 -1
- package/docs/functions/isPrimitive.html +1 -1
- package/docs/functions/mapKeys.html +1 -1
- package/docs/functions/mapValues.html +1 -1
- package/docs/functions/mergeObjects.html +1 -1
- package/docs/functions/sleep.html +1 -1
- package/docs/functions/snakeToCamel.html +1 -1
- package/docs/functions/timeLog.html +1 -1
- package/docs/functions/to.html +1 -1
- package/docs/functions/withCache.html +3 -3
- package/docs/modules.html +1 -1
- package/docs/types/DeepMapKeys.html +1 -1
- package/docs/types/DeepMapValues.html +1 -1
- package/docs/types/Falsy.html +174 -0
- package/docs/types/Primitive.html +1 -1
- package/docs/types/RequestInit.html +1 -1
- package/docs/types/SetTtl.html +1 -1
- package/package.json +1 -1
- package/src/is.ts +10 -1
- package/src/network.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var q=(...f)=>{console.log(`${new Date().toLocaleTimeString()}`,...f)};var T=(f,$=-1)=>{let x=new Map,W=(...D)=>{let H=JSON.stringify(D),I=Date.now(),M=x.get(H);if(M&&I<M.expiresAt)return M.value;let C=$===-1?1/0:I+$*1000,Q={setTtl:(X)=>{C=I+X*1000}},Y=f.apply(Q,D);if(Y instanceof Promise){let X=Y.then((Z)=>{return x.set(H,{value:Z,expiresAt:C}),Z});return x.set(H,{value:X,expiresAt:C}),X}return x.set(H,{value:Y,expiresAt:C}),Y};return W.clear=()=>x.clear(),W.updateTtl=(D)=>{$=D;let H=Date.now(),I=H+D*1000;for(let[M,C]of x.entries())if(C.expiresAt>H)C.expiresAt=I,x.set(M,C)},W};var J=(f)=>{return f?.constructor===Object},_=(f)=>{return f===null||f===void 0||typeof f!=="object"&&typeof f!=="function"},F=(f)=>{return!f},B=(f)=>{return f===null||f===void 0};var z=(f,$)=>{let x={...f};for(let W of Object.keys($)){let D=x[W],H=$[W];if(_(D)&&_(H)){x[W]=H;continue}if(Array.isArray(D)&&Array.isArray(H)){x[W]=D.concat(H);continue}if(J(D)&&J(H)){x[W]=z(D,H);continue}x[W]=H}return x},G=(f,$)=>{if(Array.isArray(f))return f.map((x)=>G(x,$));if(J(f))return Object.keys(f).reduce((W,D)=>{let H=$(D),I=f[D];return W[H]=G(I,$),W},{});return f},P=(f,$)=>{if(Array.isArray(f))return f.map((x,W)=>{if(J(x))return P(x,$);return $(x,W)});if(J(f))return Object.keys(f).reduce((W,D)=>{let H=f[D];if(J(H)||Array.isArray(H))W[D]=P(H,$);else W[D]=$(H,D);return W},{});return f};var V=(f="",$={})=>{let x=async(W,D={})=>{let H=new URL(f?`${f}${W}`:W),{params:I,parser:M,...C}=z($,D);if(J(I))Object.entries(I).forEach(([X,Z])=>{if(B(Z))return;H.searchParams.append(X,Z.toString())});if(J(C.body))C.body=JSON.stringify(C.body),C.headers={...C.headers,"Content-Type":"application/json"};let Q=await fetch(H,C);if(!Q.ok)throw Error(Q.statusText);return await(M?.(Q)??Q.json())};return{get:(W,D)=>x(W,{...D,method:"GET"}),post:(W,D,H)=>x(W,{...H,method:"POST",body:D}),put:(W,D,H)=>x(W,{...H,method:"PUT",body:D}),delete:(W,D)=>x(W,{...D,method:"DELETE"})}},m=async(f)=>{try{return[null,await f]}catch($){return[$,void 0]}};var N=(f)=>{return f.replace(/_([a-zA-Z])/g,($,x)=>x.toUpperCase())},g=(f)=>{return f.replace(/([A-Z])/g,($,x)=>`_${x.toLowerCase()}`)},h=(f)=>{return f.charAt(0).toUpperCase()+f.slice(1)},k=(f)=>{return f.charAt(0).toLowerCase()+f.slice(1)};var d=async(f=150)=>{return new Promise(($)=>{setTimeout($,f)})};export{T as withCache,m as to,q as timeLog,N as snakeToCamel,d as sleep,z as mergeObjects,P as mapValues,G as mapKeys,_ as isPrimitive,J as isObject,B as isNil,F as isFalsy,V as fetcher,k as decapitalize,h as capitalize,g as camelToSnake};
|
package/dist/is.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type Primitive = number | string | boolean | symbol | bigint | undefined | null;
|
|
2
|
+
export type Falsy = false | 0 | -0 | 0n | "" | null | undefined;
|
|
2
3
|
/**
|
|
3
4
|
* 检测传入的值是否为**普通对象**
|
|
4
5
|
* @returns 如果是普通对象,返回 true,否则返回 false
|
|
@@ -12,4 +13,8 @@ export declare const isPrimitive: (value: any) => value is Primitive;
|
|
|
12
13
|
/**
|
|
13
14
|
* 检测传入的值是否为**false值**(false、0、''、null、undefined、NaN等)
|
|
14
15
|
*/
|
|
15
|
-
export declare const isFalsy: (value: any) =>
|
|
16
|
+
export declare const isFalsy: (value: any) => value is Falsy;
|
|
17
|
+
/**
|
|
18
|
+
* 检测传入的值是否为**空值**(null、undefined)
|
|
19
|
+
*/
|
|
20
|
+
export declare const isNil: (value: any) => value is null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.navigationData = "
|
|
1
|
+
window.navigationData = "eJyFk1FLwzAQgP/LPQ+rYyrmdTIQdYobvogPMTvXc0lbl6taZf9dtjawhiR9zcf3Qbi7lz9g/GEQcI1Y3cvqFhsLI6gk5yCAmwpt5hA29iRno2EEGypWIManV5dn5+PdyK88S11jrNPCodJMatv4hcPjkPm4JUNMX+jbDuBQ4Qk/a7R8UxD7DYcK4qHKAnnJ2g+0r0Oukgb1slwUcuO+AQLe60IxlYXNjnm/dTHpZSpiqek3EnE0lgABK0xHjnkssxeQVY7bUKFDMRkEkPW2wck261BSnpMOq3PSSfHh7QMVh92WJXV/Eb1CZB17EeNfpAvYzIQu0pf9Q+zpoUPsB3C7xvaj4YbjilMZqxGrkH8AKXG/3styul/2oO+4wdQgmQzeletQoUMpuQx6ZUwBAd/E+VSqPDh3B/2pT3av/4o53jI="
|
package/docs/assets/search.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
window.searchData = "
|
|
1
|
+
window.searchData = "eJyVl1tv4zYQhf/LPBOxKd/5ukWBRdtt0Q32RTAKVWY2bHSrSGebEv7vxZAaQByoG/otPsPzOR4djscexv6bBVV6eDHdBVSxPh3krhDQVa0GBT9oPfxSDT/pNwsCrmMDCtzboO2KKvrNPjy7tgEBdVNZqy0ogJt4h/ilaq76f5ixdhf1x6qxb4wWtLsov42mNc68akYiXd9F+13/fdXWfeyMYzyqdMbdRfys3aNrGCyK3+Xst4SAump189h/7qoX+pQKnq5d7Uzf2dW8nIusq8G4qjH/LgOpmIu76O8C5+Vc5JN29bMeOa2zq6mSCzI2DRqB7Gqq5IKM/WSaRcwnk/sswdhf//xL126RE0u5KGN59lNa3g0gICho2dAgmF217w0NDuKzIkG9NysYTI9fdezMIo/KtctFgm20Hjirs6ug50Is3rfH/gPeviUWlVudGw5wptU/9185rbOrqZILcv0So8+1fzPu+UNVPy/limqLqToLMN1F/wPKw6serek7UFA8bB5OIODJ6OaC31zxfQTUfdvqDu/Cpa+v4c/zdOyLrl0/4uF4erUGUa5FcXjYnM+iJGuQg0AEUiabBFFKbnNBTm0ysRUgyoLbXJBTW5HYNiDKDbe5IKe2TWLbgii33OaCnNq2iW0Hotxxmwtyatsltj2Ics9tLsipbZ/YDiDKA7e5IKe2Q2I7giiP3OaCnNqOie0EojxxmwtyajuljxufvuQ5wcfLgzKXojVEZSkrPCxzKVoxBZLnBc/xwMylaMUkSJ4ZPMdDM5eiFdMgeW7wHA/OXIpWTITk2cFzPDxzKVoxFZLnB8/xAM2laMVkSJ4hPMdDNJeiFdMheY7wHA/SXIpWTIjkWcJzPExzKU4BTEjB04S3nqdpLkUrJqTgacJzPE0kncPwfNWj05ePcYiWZdz9XG/j7ufhj2m+7mlYe9iD8rcbTVOHr2igxle38P60gSWYA2E8HLIw6aZHIFBHAnk4ZoL00FbDS1g4iANqTRwP63s4r9O+QSRQkkgeZBbpKa6JRABFS7zyUOQRaGclBqgTMTycshjG8v9DSWoKfpS8rhjb4a5KDFBy3o68fhjbT6sqYUBJ6gli8ppi7ECLaELaEMmD3GSReFyQQksLUra5FB4WUHJHHA9yl8fBxbOnvZRQoCRdTUTl3c3FBlF/lIe89ozxF6oJv12JA4o6pDzkNchq51wSHmqO8pDXm2nBJgIoSYMGm5I3acLIc30d92tCgZI0ahCVN2twe25wryYKKEkXEyl5NxOXagLg73wCeCjyLiWuznVcq4kDqqCLiZz3Lubtht8Sgxl0YzoNqjzfbv8BEprQpg==";
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
</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></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" 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></h4><pre><code class="ts"><span class="hl-1">camelToSnake</span><span class="hl-2">(</span><span class="hl-3">"shouldComponentUpdate"</span><span class="hl-2">) </span><span class="hl-0">// "should_component_update"</span>
|
|
161
161
|
</code><button type="button">Copy</button></pre>
|
|
162
162
|
|
|
163
|
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/
|
|
163
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/string.ts#L17">string.ts:17</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
164
164
|
try {
|
|
165
165
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
166
166
|
const link = document.createElement("a");
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">s</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" 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></h4><pre><code class="ts"><span class="hl-1">capitalize</span><span class="hl-2">(</span><span class="hl-3">"hello"</span><span class="hl-2">) </span><span class="hl-0">// "Hello"</span>
|
|
161
161
|
</code><button type="button">Copy</button></pre>
|
|
162
162
|
|
|
163
|
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/
|
|
163
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/string.ts#L30">string.ts:30</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
164
164
|
try {
|
|
165
165
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
166
166
|
const link = document.createElement("a");
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">s</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" 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></h4><pre><code class="ts"><span class="hl-1">decapitalize</span><span class="hl-2">(</span><span class="hl-3">"Hello"</span><span class="hl-2">) </span><span class="hl-0">// "hello"</span>
|
|
161
161
|
</code><button type="button">Copy</button></pre>
|
|
162
162
|
|
|
163
|
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/
|
|
163
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/string.ts#L40">string.ts:40</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
164
164
|
try {
|
|
165
165
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
166
166
|
const link = document.createElement("a");
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
</div><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" 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></h4><pre><code class="ts"><span class="hl-0">// 用法1:直接发送请求</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">res</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">fetcher</span><span class="hl-2">().</span><span class="hl-1">get</span><span class="hl-2"><</span><span class="hl-8">Blog</span><span class="hl-2">>(</span><span class="hl-3">"https://nickyzj.run:3030/blogs/hello-world"</span><span class="hl-2">);</span><br/><br/><span class="hl-0">// 用法2:创建实例</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">api</span><span class="hl-2"> = </span><span class="hl-1">fetcher</span><span class="hl-2">(</span><span class="hl-3">"https://nickyzj.run:3030"</span><span class="hl-2">, { </span><span class="hl-5">headers:</span><span class="hl-2"> { </span><span class="hl-5">Authorization:</span><span class="hl-2"> </span><span class="hl-3">"Bearer token"</span><span class="hl-2"> } });</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">res</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">api</span><span class="hl-2">.</span><span class="hl-1">get</span><span class="hl-2"><</span><span class="hl-8">Blog</span><span class="hl-2">>(</span><span class="hl-3">"/blogs/hello-world"</span><span class="hl-2">, { </span><span class="hl-5">headers:</span><span class="hl-2"> {...}, </span><span class="hl-5">params:</span><span class="hl-2"> { </span><span class="hl-5">page:</span><span class="hl-2"> </span><span class="hl-9">1</span><span class="hl-2"> } }); </span><span class="hl-0">// 与实例相同的 headers 会覆盖上去,params 会转成 ?page=1 跟到 url 后面</span><br/><br/><span class="hl-0">// 安全处理请求结果</span><br/><span class="hl-6">const</span><span class="hl-2"> [</span><span class="hl-7">error</span><span class="hl-2">, </span><span class="hl-7">data</span><span class="hl-2">] = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">to</span><span class="hl-2">(</span><span class="hl-5">api</span><span class="hl-2">.</span><span class="hl-1">get</span><span class="hl-2"><</span><span class="hl-8">Blog</span><span class="hl-2">>(</span><span class="hl-3">"/blogs/hello-world"</span><span class="hl-2">));</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-5">error</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-4">return</span><span class="hl-2">;</span><br/><span class="hl-2">}</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">data</span><span class="hl-2">);</span><br/><br/><span class="hl-0">// 缓存请求结果</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">getBlogs</span><span class="hl-2"> = </span><span class="hl-1">withCache</span><span class="hl-2">(</span><span class="hl-5">api</span><span class="hl-2">.</span><span class="hl-5">get</span><span class="hl-2">);</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">getBlogs</span><span class="hl-2">(</span><span class="hl-3">"/blogs"</span><span class="hl-2">);</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">sleep</span><span class="hl-2">();</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">getBlogs</span><span class="hl-2">(</span><span class="hl-3">"/blogs"</span><span class="hl-2">); </span><span class="hl-0">// 不发请求,使用缓存</span>
|
|
171
171
|
</code><button type="button">Copy</button></pre>
|
|
172
172
|
|
|
173
|
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/
|
|
173
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/network.ts#L45">network.ts:45</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
174
174
|
try {
|
|
175
175
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
176
176
|
const link = document.createElement("a");
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
--md-sys-color-surface-container-high: #efe7de;
|
|
157
157
|
--md-sys-color-surface-container-highest: #e9e1d9
|
|
158
158
|
}
|
|
159
|
-
</style><link rel="stylesheet" href="../assets/material-style.css"/></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">@nickyzj2023/utils</a><div id="tsd-toolbar-links"></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">isFalsy</a></li></ul><h1>Function isFalsy</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="isfalsy"><span class="tsd-kind-call-signature">isFalsy</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</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-type">
|
|
160
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">
|
|
159
|
+
</style><link rel="stylesheet" href="../assets/material-style.css"/></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">@nickyzj2023/utils</a><div id="tsd-toolbar-links"></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">isFalsy</a></li></ul><h1>Function isFalsy</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="isfalsy"><span class="tsd-kind-call-signature">isFalsy</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</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-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <a href="../types/Falsy.html" class="tsd-signature-type tsd-kind-type-alias">Falsy</a><a href="#isfalsy" 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>检测传入的值是否为<strong>false值</strong>(false、0、''、null、undefined、NaN等)</p>
|
|
160
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <a href="../types/Falsy.html" class="tsd-signature-type tsd-kind-type-alias">Falsy</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/is.ts#L35">is.ts:35</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
161
161
|
try {
|
|
162
162
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
163
163
|
const link = document.createElement("a");
|
|
@@ -0,0 +1,175 @@
|
|
|
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>isNil | @nickyzj2023/utils</title><meta name="description" content="Documentation for @nickyzj2023/utils"/><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><style>
|
|
2
|
+
@media (prefers-color-scheme: dark) {
|
|
3
|
+
:root {
|
|
4
|
+
--md-sys-color-primary: #f6be46;
|
|
5
|
+
--md-sys-color-on-primary: #412d00;
|
|
6
|
+
--md-sys-color-primary-container: #5d4200;
|
|
7
|
+
--md-sys-color-on-primary-container: #ffdea3;
|
|
8
|
+
--md-sys-color-secondary: #d9c4a0;
|
|
9
|
+
--md-sys-color-on-secondary: #3b2f15;
|
|
10
|
+
--md-sys-color-secondary-container: #53452a;
|
|
11
|
+
--md-sys-color-on-secondary-container: #f6e0bb;
|
|
12
|
+
--md-sys-color-tertiary: #b2cfa8;
|
|
13
|
+
--md-sys-color-on-tertiary: #1e361a;
|
|
14
|
+
--md-sys-color-tertiary-container: #344d2f;
|
|
15
|
+
--md-sys-color-on-tertiary-container: #cdebc2;
|
|
16
|
+
--md-sys-color-error: #ffb4ab;
|
|
17
|
+
--md-sys-color-on-error: #690005;
|
|
18
|
+
--md-sys-color-error-container: #93000a;
|
|
19
|
+
--md-sys-color-on-error-container: #ffb4ab;
|
|
20
|
+
--md-sys-color-background: #1e1b16;
|
|
21
|
+
--md-sys-color-on-background: #e9e1d9;
|
|
22
|
+
--md-sys-color-surface: #1e1b16;
|
|
23
|
+
--md-sys-color-on-surface: #e9e1d9;
|
|
24
|
+
--md-sys-color-surface-variant: #4e4639;
|
|
25
|
+
--md-sys-color-on-surface-variant: #d1c5b4;
|
|
26
|
+
--md-sys-color-outline: #9a8f80;
|
|
27
|
+
--md-sys-color-outline-variant: #4e4639;
|
|
28
|
+
--md-sys-color-shadow: #000000;
|
|
29
|
+
--md-sys-color-scrim: #000000;
|
|
30
|
+
--md-sys-color-inverse-surface: #e9e1d9;
|
|
31
|
+
--md-sys-color-inverse-on-surface: #34302a;
|
|
32
|
+
--md-sys-color-inverse-primary: #7a5900;
|
|
33
|
+
--md-sys-color-surface-dim: #16130e;
|
|
34
|
+
--md-sys-color-surface-bright: #3d3933;
|
|
35
|
+
--md-sys-color-surface-container-lowest: #110e09;
|
|
36
|
+
--md-sys-color-surface-container-low: #1e1b16;
|
|
37
|
+
--md-sys-color-surface-container: #221f1a;
|
|
38
|
+
--md-sys-color-surface-container-high: #2d2924;
|
|
39
|
+
--md-sys-color-surface-container-highest: #38342e
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
:root[data-theme="dark"] {
|
|
43
|
+
--md-sys-color-primary: #f6be46;
|
|
44
|
+
--md-sys-color-on-primary: #412d00;
|
|
45
|
+
--md-sys-color-primary-container: #5d4200;
|
|
46
|
+
--md-sys-color-on-primary-container: #ffdea3;
|
|
47
|
+
--md-sys-color-secondary: #d9c4a0;
|
|
48
|
+
--md-sys-color-on-secondary: #3b2f15;
|
|
49
|
+
--md-sys-color-secondary-container: #53452a;
|
|
50
|
+
--md-sys-color-on-secondary-container: #f6e0bb;
|
|
51
|
+
--md-sys-color-tertiary: #b2cfa8;
|
|
52
|
+
--md-sys-color-on-tertiary: #1e361a;
|
|
53
|
+
--md-sys-color-tertiary-container: #344d2f;
|
|
54
|
+
--md-sys-color-on-tertiary-container: #cdebc2;
|
|
55
|
+
--md-sys-color-error: #ffb4ab;
|
|
56
|
+
--md-sys-color-on-error: #690005;
|
|
57
|
+
--md-sys-color-error-container: #93000a;
|
|
58
|
+
--md-sys-color-on-error-container: #ffb4ab;
|
|
59
|
+
--md-sys-color-background: #1e1b16;
|
|
60
|
+
--md-sys-color-on-background: #e9e1d9;
|
|
61
|
+
--md-sys-color-surface: #1e1b16;
|
|
62
|
+
--md-sys-color-on-surface: #e9e1d9;
|
|
63
|
+
--md-sys-color-surface-variant: #4e4639;
|
|
64
|
+
--md-sys-color-on-surface-variant: #d1c5b4;
|
|
65
|
+
--md-sys-color-outline: #9a8f80;
|
|
66
|
+
--md-sys-color-outline-variant: #4e4639;
|
|
67
|
+
--md-sys-color-shadow: #000000;
|
|
68
|
+
--md-sys-color-scrim: #000000;
|
|
69
|
+
--md-sys-color-inverse-surface: #e9e1d9;
|
|
70
|
+
--md-sys-color-inverse-on-surface: #34302a;
|
|
71
|
+
--md-sys-color-inverse-primary: #7a5900;
|
|
72
|
+
--md-sys-color-surface-dim: #16130e;
|
|
73
|
+
--md-sys-color-surface-bright: #3d3933;
|
|
74
|
+
--md-sys-color-surface-container-lowest: #110e09;
|
|
75
|
+
--md-sys-color-surface-container-low: #1e1b16;
|
|
76
|
+
--md-sys-color-surface-container: #221f1a;
|
|
77
|
+
--md-sys-color-surface-container-high: #2d2924;
|
|
78
|
+
--md-sys-color-surface-container-highest: #38342e
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (prefers-color-scheme: light) {
|
|
82
|
+
:root {
|
|
83
|
+
--md-sys-color-primary: #7a5900;
|
|
84
|
+
--md-sys-color-on-primary: #ffffff;
|
|
85
|
+
--md-sys-color-primary-container: #ffdea3;
|
|
86
|
+
--md-sys-color-on-primary-container: #261900;
|
|
87
|
+
--md-sys-color-secondary: #6c5c3f;
|
|
88
|
+
--md-sys-color-on-secondary: #ffffff;
|
|
89
|
+
--md-sys-color-secondary-container: #f6e0bb;
|
|
90
|
+
--md-sys-color-on-secondary-container: #251a04;
|
|
91
|
+
--md-sys-color-tertiary: #4b6545;
|
|
92
|
+
--md-sys-color-on-tertiary: #ffffff;
|
|
93
|
+
--md-sys-color-tertiary-container: #cdebc2;
|
|
94
|
+
--md-sys-color-on-tertiary-container: #092007;
|
|
95
|
+
--md-sys-color-error: #ba1a1a;
|
|
96
|
+
--md-sys-color-on-error: #ffffff;
|
|
97
|
+
--md-sys-color-error-container: #ffdad6;
|
|
98
|
+
--md-sys-color-on-error-container: #410002;
|
|
99
|
+
--md-sys-color-background: #fffbff;
|
|
100
|
+
--md-sys-color-on-background: #1e1b16;
|
|
101
|
+
--md-sys-color-surface: #fffbff;
|
|
102
|
+
--md-sys-color-on-surface: #1e1b16;
|
|
103
|
+
--md-sys-color-surface-variant: #ede1cf;
|
|
104
|
+
--md-sys-color-on-surface-variant: #4e4639;
|
|
105
|
+
--md-sys-color-outline: #7f7667;
|
|
106
|
+
--md-sys-color-outline-variant: #d1c5b4;
|
|
107
|
+
--md-sys-color-shadow: #000000;
|
|
108
|
+
--md-sys-color-scrim: #000000;
|
|
109
|
+
--md-sys-color-inverse-surface: #34302a;
|
|
110
|
+
--md-sys-color-inverse-on-surface: #f8efe7;
|
|
111
|
+
--md-sys-color-inverse-primary: #f6be46;
|
|
112
|
+
--md-sys-color-surface-dim: #e1d9d0;
|
|
113
|
+
--md-sys-color-surface-bright: #fff8f2;
|
|
114
|
+
--md-sys-color-surface-container-lowest: #ffffff;
|
|
115
|
+
--md-sys-color-surface-container-low: #fbf2e9;
|
|
116
|
+
--md-sys-color-surface-container: #f5ede4;
|
|
117
|
+
--md-sys-color-surface-container-high: #efe7de;
|
|
118
|
+
--md-sys-color-surface-container-highest: #e9e1d9
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
:root[data-theme="light"] {
|
|
122
|
+
--md-sys-color-primary: #7a5900;
|
|
123
|
+
--md-sys-color-on-primary: #ffffff;
|
|
124
|
+
--md-sys-color-primary-container: #ffdea3;
|
|
125
|
+
--md-sys-color-on-primary-container: #261900;
|
|
126
|
+
--md-sys-color-secondary: #6c5c3f;
|
|
127
|
+
--md-sys-color-on-secondary: #ffffff;
|
|
128
|
+
--md-sys-color-secondary-container: #f6e0bb;
|
|
129
|
+
--md-sys-color-on-secondary-container: #251a04;
|
|
130
|
+
--md-sys-color-tertiary: #4b6545;
|
|
131
|
+
--md-sys-color-on-tertiary: #ffffff;
|
|
132
|
+
--md-sys-color-tertiary-container: #cdebc2;
|
|
133
|
+
--md-sys-color-on-tertiary-container: #092007;
|
|
134
|
+
--md-sys-color-error: #ba1a1a;
|
|
135
|
+
--md-sys-color-on-error: #ffffff;
|
|
136
|
+
--md-sys-color-error-container: #ffdad6;
|
|
137
|
+
--md-sys-color-on-error-container: #410002;
|
|
138
|
+
--md-sys-color-background: #fffbff;
|
|
139
|
+
--md-sys-color-on-background: #1e1b16;
|
|
140
|
+
--md-sys-color-surface: #fffbff;
|
|
141
|
+
--md-sys-color-on-surface: #1e1b16;
|
|
142
|
+
--md-sys-color-surface-variant: #ede1cf;
|
|
143
|
+
--md-sys-color-on-surface-variant: #4e4639;
|
|
144
|
+
--md-sys-color-outline: #7f7667;
|
|
145
|
+
--md-sys-color-outline-variant: #d1c5b4;
|
|
146
|
+
--md-sys-color-shadow: #000000;
|
|
147
|
+
--md-sys-color-scrim: #000000;
|
|
148
|
+
--md-sys-color-inverse-surface: #34302a;
|
|
149
|
+
--md-sys-color-inverse-on-surface: #f8efe7;
|
|
150
|
+
--md-sys-color-inverse-primary: #f6be46;
|
|
151
|
+
--md-sys-color-surface-dim: #e1d9d0;
|
|
152
|
+
--md-sys-color-surface-bright: #fff8f2;
|
|
153
|
+
--md-sys-color-surface-container-lowest: #ffffff;
|
|
154
|
+
--md-sys-color-surface-container-low: #fbf2e9;
|
|
155
|
+
--md-sys-color-surface-container: #f5ede4;
|
|
156
|
+
--md-sys-color-surface-container-high: #efe7de;
|
|
157
|
+
--md-sys-color-surface-container-highest: #e9e1d9
|
|
158
|
+
}
|
|
159
|
+
</style><link rel="stylesheet" href="../assets/material-style.css"/></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">@nickyzj2023/utils</a><div id="tsd-toolbar-links"></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">isNil</a></li></ul><h1>Function isNil</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="isnil"><span class="tsd-kind-call-signature">isNil</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</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-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <span class="tsd-signature-type">null</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">undefined</span><a href="#isnil" 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>检测传入的值是否为<strong>空值</strong>(null、undefined)</p>
|
|
160
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <span class="tsd-signature-type">null</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">undefined</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/is.ts#L42">is.ts:42</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
161
|
+
try {
|
|
162
|
+
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
163
|
+
const link = document.createElement("a");
|
|
164
|
+
Object.assign(link, {
|
|
165
|
+
href: "https://github.com/dmnsgn/typedoc-material-theme",
|
|
166
|
+
target: "_blank",
|
|
167
|
+
rel: "noreferrer",
|
|
168
|
+
innerText: "typedoc-material-theme."
|
|
169
|
+
});
|
|
170
|
+
generateLinkElement.insertAdjacentElement("afterend", link);
|
|
171
|
+
generateLinkElement.insertAdjacentText("afterend", " with ");
|
|
172
|
+
} catch (error) {
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
</script></body></html>
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
</style><link rel="stylesheet" href="../assets/material-style.css"/></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">@nickyzj2023/utils</a><div id="tsd-toolbar-links"></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">isObject</a></li></ul><h1>Function isObject</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="isobject"><span class="tsd-kind-call-signature">isObject</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</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-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <span class="tsd-signature-type">object</span><a href="#isobject" 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>检测传入的值是否为<strong>普通对象</strong></p>
|
|
160
160
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <span class="tsd-signature-type">object</span></h4><p>如果是普通对象,返回 true,否则返回 false</p>
|
|
161
|
-
<aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/
|
|
161
|
+
<aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/is.ts#L16">is.ts:16</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
162
162
|
try {
|
|
163
163
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
164
164
|
const link = document.createElement("a");
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
</style><link rel="stylesheet" href="../assets/material-style.css"/></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">@nickyzj2023/utils</a><div id="tsd-toolbar-links"></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">isPrimitive</a></li></ul><h1>Function isPrimitive</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="isprimitive"><span class="tsd-kind-call-signature">isPrimitive</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">value</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-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <a href="../types/Primitive.html" class="tsd-signature-type tsd-kind-type-alias">Primitive</a><a href="#isprimitive" 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>检测传入的值是否为<strong>原始值</strong>(number、string、boolean、symbol、bigint、undefined、null)</p>
|
|
160
160
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">value</span> <span class="tsd-signature-keyword">is</span> <a href="../types/Primitive.html" class="tsd-signature-type tsd-kind-type-alias">Primitive</a></h4><p>如果是原始值,返回 true,否则返回 false</p>
|
|
161
|
-
<aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/
|
|
161
|
+
<aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/is.ts#L24">is.ts:24</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
162
162
|
try {
|
|
163
163
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
164
164
|
const link = document.createElement("a");
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
</div><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" 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></h4><pre><code class="ts"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">obj</span><span class="hl-2"> = { </span><span class="hl-5">a:</span><span class="hl-2"> { </span><span class="hl-5">b:</span><span class="hl-2"> </span><span class="hl-9">1</span><span class="hl-2"> } };</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-7">result</span><span class="hl-2"> = </span><span class="hl-1">mapKeys</span><span class="hl-2">(</span><span class="hl-5">obj</span><span class="hl-2">, (</span><span class="hl-5">key</span><span class="hl-2">) </span><span class="hl-6">=></span><span class="hl-2"> </span><span class="hl-5">key</span><span class="hl-2">.</span><span class="hl-1">toUpperCase</span><span class="hl-2">());</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-5">result</span><span class="hl-2">); </span><span class="hl-0">// { A: { B: 1 } }</span>
|
|
163
163
|
</code><button type="button">Copy</button></pre>
|
|
164
164
|
|
|
165
|
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/
|
|
165
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Nickyzj628/utils/blob/6208aac5a1cdd0f393228dfdfffcc749795954d1/src/object.ts#L76">object.ts:76</a></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 class="tsd-navigation"><a href="../modules.html">@nickyzj2023/utils</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><script>
|
|
166
166
|
try {
|
|
167
167
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
168
168
|
const link = document.createElement("a");
|