@dazhicheng/utils 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/file.d.ts +11 -0
- package/dist/file.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/package.json +1 -1
package/dist/file.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,UAAU,OAAO;IACf,IAAI,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,EAAE,MAAM,MAAM,SAyBtD,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";exports.capitalize=function(
|
|
1
|
+
"use strict";exports.capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},exports.divide=function(e,t){return e/t},exports.downloadFile=(e,t)=>{try{console.log(e.data);const o=new Blob([e.data],{type:t}),n=document.createElement("a"),r=(window.URL||window.webkitURL).createObjectURL(o);n.href=r;let i=(e.headers["content-disposition"]||"").split("=")||"";i=i[i.length-1],i=decodeURI(i.replace(/"/g,"")),i=i?.split("''"),i=i?.[i.length-1],n.download=i,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)}catch(e){console.log(e)}},exports.multiply=function(e,t){return e*t},exports.subtract=function(e,t){return e-t},exports.sum=function(e,t){return e+t},exports.trim=function(e){return e.trim()};
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/string.ts","../src/math.ts"],"sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function trim(str: string): string {\n return str.trim();\n}","export function sum(a: number, b: number): number {\n return a + b;\n}\n\nexport function multiply(a: number, b: number): number {\n return a * b;\n}\n\nexport function subtract(a: number, b: number): number {\n return a - b;\n}\n\nexport function divide(a: number, b: number): number {\n return a / b;\n}"],"names":["str","charAt","toUpperCase","slice","a","b","trim"],"mappings":"gCAAM,SAAqBA,GACzB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,MAAM,EACjD,iBCUM,SAAiBC,EAAWC,GAChC,OAAOD,EAAIC,CACb,
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/string.ts","../src/math.ts","../src/file.ts"],"sourcesContent":["export function capitalize(str: string): string {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n}\r\n\r\nexport function trim(str: string): string {\r\n return str.trim();\r\n}","export function sum(a: number, b: number): number {\r\n return a + b;\r\n}\r\n\r\nexport function multiply(a: number, b: number): number {\r\n return a * b;\r\n}\r\n\r\nexport function subtract(a: number, b: number): number {\r\n return a - b;\r\n}\r\n\r\nexport function divide(a: number, b: number): number {\r\n return a / b;\r\n}","/**\r\n * @param res 响应 { data: Blob, ... }\r\n * @param type 类型\r\n */\r\ninterface FileRes {\r\n data: Blob;\r\n [key: string]: any;\r\n}\r\n\r\nexport const downloadFile = (res: FileRes, type: string) => {\r\n try {\r\n // 创建blob对象,解析流数据\r\n console.log(res.data);\r\n const blob = new Blob([res.data], {\r\n type,\r\n });\r\n const a = document.createElement('a');\r\n const URL = window.URL || window.webkitURL;\r\n const herf = URL.createObjectURL(blob);\r\n a.href = herf;\r\n let fileName = (res.headers['content-disposition'] || '').split('=') || '';\r\n fileName = fileName[fileName.length - 1];\r\n fileName = decodeURI(fileName.replace(/\"/g, ''));\r\n fileName = fileName?.split(\"''\");\r\n fileName = fileName?.[fileName.length - 1];\r\n a.download = fileName;\r\n a.style.display = 'none';\r\n document.body.appendChild(a);\r\n a.click();\r\n document.body.removeChild(a);\r\n window.URL.revokeObjectURL(herf);\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n};\r\n"],"names":["str","charAt","toUpperCase","slice","a","b","res","type","console","log","data","blob","Blob","document","createElement","herf","window","URL","webkitURL","createObjectURL","href","fileName","headers","split","length","decodeURI","replace","download","style","display","body","appendChild","click","removeChild","revokeObjectURL","error","trim"],"mappings":"gCAAM,SAAqBA,GACzB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,MAAM,EACjD,iBCUM,SAAiBC,EAAWC,GAChC,OAAOD,EAAIC,CACb,uBCL4B,CAACC,EAAcC,KACzC,IAEEC,QAAQC,IAAIH,EAAII,MAChB,MAAMC,EAAO,IAAIC,KAAK,CAACN,EAAII,MAAO,CAChCH,SAEIH,EAAIS,SAASC,cAAc,KAE3BC,GADMC,OAAOC,KAAOD,OAAOE,WAChBC,gBAAgBR,GACjCP,EAAEgB,KAAOL,EACT,IAAIM,GAAYf,EAAIgB,QAAQ,wBAA0B,IAAIC,MAAM,MAAQ,GACxEF,EAAWA,EAASA,EAASG,OAAS,GACtCH,EAAWI,UAAUJ,EAASK,QAAQ,KAAM,KAC5CL,EAAWA,GAAUE,MAAM,MAC3BF,EAAWA,IAAWA,EAASG,OAAS,GACxCpB,EAAEuB,SAAWN,EACbjB,EAAEwB,MAAMC,QAAU,OAClBhB,SAASiB,KAAKC,YAAY3B,GAC1BA,EAAE4B,QACFnB,SAASiB,KAAKG,YAAY7B,GAC1BY,OAAOC,IAAIiB,gBAAgBnB,EAC7B,CAAE,MAAOoB,GACP3B,QAAQC,IAAI0B,EACd,oBD7BI,SAAmB/B,EAAWC,GAClC,OAAOD,EAAIC,CACb,mBAEM,SAAmBD,EAAWC,GAClC,OAAOD,EAAIC,CACb,cAVM,SAAcD,EAAWC,GAC7B,OAAOD,EAAIC,CACb,eDEM,SAAeL,GACnB,OAAOA,EAAIoC,MACb"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e){return e.charAt(0).toUpperCase()+e.slice(1)}function t(e){return e.trim()}function n(e,t){return e+t}function o(e,t){return e*t}function c(e,t){return e-t}function r(e,t){return e/t}const i=(e,t)=>{try{console.log(e.data);const n=new Blob([e.data],{type:t}),o=document.createElement("a"),c=(window.URL||window.webkitURL).createObjectURL(n);o.href=c;let r=(e.headers["content-disposition"]||"").split("=")||"";r=r[r.length-1],r=decodeURI(r.replace(/"/g,"")),r=r?.split("''"),r=r?.[r.length-1],o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(c)}catch(e){console.log(e)}};export{e as capitalize,r as divide,i as downloadFile,o as multiply,c as subtract,n as sum,t as trim};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/string.ts","../src/math.ts"],"sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function trim(str: string): string {\n return str.trim();\n}","export function sum(a: number, b: number): number {\n return a + b;\n}\n\nexport function multiply(a: number, b: number): number {\n return a * b;\n}\n\nexport function subtract(a: number, b: number): number {\n return a - b;\n}\n\nexport function divide(a: number, b: number): number {\n return a / b;\n}"],"names":["capitalize","str","charAt","toUpperCase","slice","trim","sum","a","b","multiply","subtract","divide"],"mappings":"AAAM,SAAUA,EAAWC,GACzB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,MAAM,EACjD,CAEM,SAAUC,EAAKJ,GACnB,OAAOA,EAAII,MACb,CCNM,SAAUC,EAAIC,EAAWC,GAC7B,OAAOD,EAAIC,CACb,CAEM,SAAUC,EAASF,EAAWC,GAClC,OAAOD,EAAIC,CACb,CAEM,SAAUE,EAASH,EAAWC,GAClC,OAAOD,EAAIC,CACb,CAEM,SAAUG,EAAOJ,EAAWC,GAChC,OAAOD,EAAIC,CACb"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/string.ts","../src/math.ts","../src/file.ts"],"sourcesContent":["export function capitalize(str: string): string {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n}\r\n\r\nexport function trim(str: string): string {\r\n return str.trim();\r\n}","export function sum(a: number, b: number): number {\r\n return a + b;\r\n}\r\n\r\nexport function multiply(a: number, b: number): number {\r\n return a * b;\r\n}\r\n\r\nexport function subtract(a: number, b: number): number {\r\n return a - b;\r\n}\r\n\r\nexport function divide(a: number, b: number): number {\r\n return a / b;\r\n}","/**\r\n * @param res 响应 { data: Blob, ... }\r\n * @param type 类型\r\n */\r\ninterface FileRes {\r\n data: Blob;\r\n [key: string]: any;\r\n}\r\n\r\nexport const downloadFile = (res: FileRes, type: string) => {\r\n try {\r\n // 创建blob对象,解析流数据\r\n console.log(res.data);\r\n const blob = new Blob([res.data], {\r\n type,\r\n });\r\n const a = document.createElement('a');\r\n const URL = window.URL || window.webkitURL;\r\n const herf = URL.createObjectURL(blob);\r\n a.href = herf;\r\n let fileName = (res.headers['content-disposition'] || '').split('=') || '';\r\n fileName = fileName[fileName.length - 1];\r\n fileName = decodeURI(fileName.replace(/\"/g, ''));\r\n fileName = fileName?.split(\"''\");\r\n fileName = fileName?.[fileName.length - 1];\r\n a.download = fileName;\r\n a.style.display = 'none';\r\n document.body.appendChild(a);\r\n a.click();\r\n document.body.removeChild(a);\r\n window.URL.revokeObjectURL(herf);\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n};\r\n"],"names":["capitalize","str","charAt","toUpperCase","slice","trim","sum","a","b","multiply","subtract","divide","downloadFile","res","type","console","log","data","blob","Blob","document","createElement","herf","window","URL","webkitURL","createObjectURL","href","fileName","headers","split","length","decodeURI","replace","download","style","display","body","appendChild","click","removeChild","revokeObjectURL","error"],"mappings":"AAAM,SAAUA,EAAWC,GACzB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,MAAM,EACjD,CAEM,SAAUC,EAAKJ,GACnB,OAAOA,EAAII,MACb,CCNM,SAAUC,EAAIC,EAAWC,GAC7B,OAAOD,EAAIC,CACb,CAEM,SAAUC,EAASF,EAAWC,GAClC,OAAOD,EAAIC,CACb,CAEM,SAAUE,EAASH,EAAWC,GAClC,OAAOD,EAAIC,CACb,CAEM,SAAUG,EAAOJ,EAAWC,GAChC,OAAOD,EAAIC,CACb,OCLaI,EAAe,CAACC,EAAcC,KACzC,IAEEC,QAAQC,IAAIH,EAAII,MAChB,MAAMC,EAAO,IAAIC,KAAK,CAACN,EAAII,MAAO,CAChCH,SAEIP,EAAIa,SAASC,cAAc,KAE3BC,GADMC,OAAOC,KAAOD,OAAOE,WAChBC,gBAAgBR,GACjCX,EAAEoB,KAAOL,EACT,IAAIM,GAAYf,EAAIgB,QAAQ,wBAA0B,IAAIC,MAAM,MAAQ,GACxEF,EAAWA,EAASA,EAASG,OAAS,GACtCH,EAAWI,UAAUJ,EAASK,QAAQ,KAAM,KAC5CL,EAAWA,GAAUE,MAAM,MAC3BF,EAAWA,IAAWA,EAASG,OAAS,GACxCxB,EAAE2B,SAAWN,EACbrB,EAAE4B,MAAMC,QAAU,OAClBhB,SAASiB,KAAKC,YAAY/B,GAC1BA,EAAEgC,QACFnB,SAASiB,KAAKG,YAAYjC,GAC1BgB,OAAOC,IAAIiB,gBAAgBnB,EAC7B,CAAE,MAAOoB,GACP3B,QAAQC,IAAI0B,EACd"}
|
package/dist/index.iife.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var TtyiMonorepoUtils=function(t){"use strict";return t.capitalize=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},t.divide=function(t,
|
|
1
|
+
var TtyiMonorepoUtils=function(t){"use strict";return t.capitalize=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},t.divide=function(t,e){return t/e},t.downloadFile=(t,e)=>{try{console.log(t.data);const n=new Blob([t.data],{type:e}),o=document.createElement("a"),i=(window.URL||window.webkitURL).createObjectURL(n);o.href=i;let r=(t.headers["content-disposition"]||"").split("=")||"";r=r[r.length-1],r=decodeURI(r.replace(/"/g,"")),r=r?.split("''"),r=r?.[r.length-1],o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(i)}catch(t){console.log(t)}},t.multiply=function(t,e){return t*e},t.subtract=function(t,e){return t-e},t.sum=function(t,e){return t+e},t.trim=function(t){return t.trim()},t}({});
|
|
2
2
|
//# sourceMappingURL=index.iife.js.map
|
package/dist/index.iife.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.iife.js","sources":["../src/string.ts","../src/math.ts"],"sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function trim(str: string): string {\n return str.trim();\n}","export function sum(a: number, b: number): number {\n return a + b;\n}\n\nexport function multiply(a: number, b: number): number {\n return a * b;\n}\n\nexport function subtract(a: number, b: number): number {\n return a - b;\n}\n\nexport function divide(a: number, b: number): number {\n return a / b;\n}"],"names":["str","charAt","toUpperCase","slice","a","b","trim"],"mappings":"mEAAM,SAAqBA,GACzB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,MAAM,EACjD,WCUM,SAAiBC,EAAWC,GAChC,OAAOD,EAAIC,CACb,
|
|
1
|
+
{"version":3,"file":"index.iife.js","sources":["../src/string.ts","../src/math.ts","../src/file.ts"],"sourcesContent":["export function capitalize(str: string): string {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n}\r\n\r\nexport function trim(str: string): string {\r\n return str.trim();\r\n}","export function sum(a: number, b: number): number {\r\n return a + b;\r\n}\r\n\r\nexport function multiply(a: number, b: number): number {\r\n return a * b;\r\n}\r\n\r\nexport function subtract(a: number, b: number): number {\r\n return a - b;\r\n}\r\n\r\nexport function divide(a: number, b: number): number {\r\n return a / b;\r\n}","/**\r\n * @param res 响应 { data: Blob, ... }\r\n * @param type 类型\r\n */\r\ninterface FileRes {\r\n data: Blob;\r\n [key: string]: any;\r\n}\r\n\r\nexport const downloadFile = (res: FileRes, type: string) => {\r\n try {\r\n // 创建blob对象,解析流数据\r\n console.log(res.data);\r\n const blob = new Blob([res.data], {\r\n type,\r\n });\r\n const a = document.createElement('a');\r\n const URL = window.URL || window.webkitURL;\r\n const herf = URL.createObjectURL(blob);\r\n a.href = herf;\r\n let fileName = (res.headers['content-disposition'] || '').split('=') || '';\r\n fileName = fileName[fileName.length - 1];\r\n fileName = decodeURI(fileName.replace(/\"/g, ''));\r\n fileName = fileName?.split(\"''\");\r\n fileName = fileName?.[fileName.length - 1];\r\n a.download = fileName;\r\n a.style.display = 'none';\r\n document.body.appendChild(a);\r\n a.click();\r\n document.body.removeChild(a);\r\n window.URL.revokeObjectURL(herf);\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n};\r\n"],"names":["str","charAt","toUpperCase","slice","a","b","res","type","console","log","data","blob","Blob","document","createElement","herf","window","URL","webkitURL","createObjectURL","href","fileName","headers","split","length","decodeURI","replace","download","style","display","body","appendChild","click","removeChild","revokeObjectURL","error","trim"],"mappings":"mEAAM,SAAqBA,GACzB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,MAAM,EACjD,WCUM,SAAiBC,EAAWC,GAChC,OAAOD,EAAIC,CACb,iBCL4B,CAACC,EAAcC,KACzC,IAEEC,QAAQC,IAAIH,EAAII,MAChB,MAAMC,EAAO,IAAIC,KAAK,CAACN,EAAII,MAAO,CAChCH,SAEIH,EAAIS,SAASC,cAAc,KAE3BC,GADMC,OAAOC,KAAOD,OAAOE,WAChBC,gBAAgBR,GACjCP,EAAEgB,KAAOL,EACT,IAAIM,GAAYf,EAAIgB,QAAQ,wBAA0B,IAAIC,MAAM,MAAQ,GACxEF,EAAWA,EAASA,EAASG,OAAS,GACtCH,EAAWI,UAAUJ,EAASK,QAAQ,KAAM,KAC5CL,EAAWA,GAAUE,MAAM,MAC3BF,EAAWA,IAAWA,EAASG,OAAS,GACxCpB,EAAEuB,SAAWN,EACbjB,EAAEwB,MAAMC,QAAU,OAClBhB,SAASiB,KAAKC,YAAY3B,GAC1BA,EAAE4B,QACFnB,SAASiB,KAAKG,YAAY7B,GAC1BY,OAAOC,IAAIiB,gBAAgBnB,EAC7B,CAAE,MAAOoB,GACP3B,QAAQC,IAAI0B,EACd,cD7BI,SAAmB/B,EAAWC,GAClC,OAAOD,EAAIC,CACb,aAEM,SAAmBD,EAAWC,GAClC,OAAOD,EAAIC,CACb,QAVM,SAAcD,EAAWC,GAC7B,OAAOD,EAAIC,CACb,SDEM,SAAeL,GACnB,OAAOA,EAAIoC,MACb"}
|