@choksheak/ts-utils 0.3.6 → 0.3.7
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/arrayBuffer.cjs +39 -10
- package/arrayBuffer.min.cjs +1 -1
- package/arrayBuffer.min.cjs.map +1 -1
- package/arrayBuffer.min.mjs +1 -1
- package/arrayBuffer.min.mjs.map +1 -1
- package/arrayBuffer.mjs +10 -7
- package/asNumber.cjs +38 -6
- package/asNumber.min.cjs +1 -1
- package/asNumber.min.cjs.map +1 -1
- package/asNumber.min.mjs +1 -1
- package/asNumber.min.mjs.map +1 -1
- package/asNumber.mjs +11 -4
- package/assert.cjs +27 -4
- package/assert.min.cjs +1 -1
- package/assert.min.cjs.map +1 -1
- package/assert.min.mjs +1 -1
- package/assert.min.mjs.map +1 -1
- package/assert.mjs +0 -2
- package/base64Url.cjs +29 -5
- package/base64Url.min.cjs +1 -1
- package/base64Url.min.cjs.map +1 -1
- package/base64Url.min.mjs +1 -1
- package/base64Url.min.mjs.map +1 -1
- package/base64Url.mjs +0 -2
- package/capLength.cjs +71 -7
- package/capLength.min.cjs +5 -1
- package/capLength.min.cjs.map +1 -1
- package/capLength.min.mjs +5 -1
- package/capLength.min.mjs.map +1 -1
- package/capLength.mjs +41 -4
- package/concatIterators.cjs +27 -4
- package/concatIterators.min.cjs +1 -1
- package/concatIterators.min.cjs.map +1 -1
- package/concatIterators.min.mjs +1 -1
- package/concatIterators.min.mjs.map +1 -1
- package/concatIterators.mjs +0 -2
- package/dateTimeStr.cjs +119 -31
- package/dateTimeStr.min.cjs +1 -1
- package/dateTimeStr.min.cjs.map +1 -1
- package/dateTimeStr.min.mjs +1 -1
- package/dateTimeStr.min.mjs.map +1 -1
- package/dateTimeStr.mjs +69 -17
- package/duration.cjs +188 -24
- package/duration.min.cjs +1 -1
- package/duration.min.cjs.map +1 -1
- package/duration.min.mjs +1 -1
- package/duration.min.mjs.map +1 -1
- package/duration.mjs +144 -14
- package/getEnv.cjs +31 -7
- package/getEnv.min.cjs +1 -1
- package/getEnv.min.cjs.map +1 -1
- package/getEnv.min.mjs +1 -1
- package/getEnv.min.mjs.map +1 -1
- package/getEnv.mjs +0 -2
- package/isEmpty.cjs +46 -8
- package/isEmpty.min.cjs +1 -1
- package/isEmpty.min.cjs.map +1 -1
- package/isEmpty.min.mjs +1 -1
- package/isEmpty.min.mjs.map +1 -1
- package/isEmpty.mjs +19 -6
- package/isPromise.cjs +29 -5
- package/isPromise.min.cjs +1 -1
- package/isPromise.min.cjs.map +1 -1
- package/isPromise.min.mjs +1 -1
- package/isPromise.min.mjs.map +1 -1
- package/isPromise.mjs +0 -2
- package/kvStore.cjs +353 -15
- package/kvStore.min.cjs +1 -1
- package/kvStore.min.cjs.map +1 -1
- package/kvStore.min.mjs +1 -1
- package/kvStore.min.mjs.map +1 -1
- package/kvStore.mjs +319 -12
- package/localStore.cjs +264 -15
- package/localStore.min.cjs +1 -1
- package/localStore.min.cjs.map +1 -1
- package/localStore.min.mjs +1 -1
- package/localStore.min.mjs.map +1 -1
- package/localStore.mjs +230 -12
- package/mean.cjs +48 -8
- package/mean.min.cjs +1 -1
- package/mean.min.cjs.map +1 -1
- package/mean.min.mjs +1 -1
- package/mean.min.mjs.map +1 -1
- package/mean.mjs +18 -5
- package/median.cjs +41 -7
- package/median.min.cjs +1 -1
- package/median.min.cjs.map +1 -1
- package/median.min.mjs +1 -1
- package/median.min.mjs.map +1 -1
- package/median.mjs +11 -4
- package/nonEmpty.cjs +48 -8
- package/nonEmpty.min.cjs +1 -1
- package/nonEmpty.min.cjs.map +1 -1
- package/nonEmpty.min.mjs +1 -1
- package/nonEmpty.min.mjs.map +1 -1
- package/nonEmpty.mjs +19 -6
- package/nonNil.cjs +27 -4
- package/nonNil.min.cjs +1 -1
- package/nonNil.min.cjs.map +1 -1
- package/nonNil.min.mjs +1 -1
- package/nonNil.min.mjs.map +1 -1
- package/nonNil.mjs +0 -2
- package/package.json +1 -257
- package/round.cjs +32 -6
- package/round.min.cjs +1 -1
- package/round.min.cjs.map +1 -1
- package/round.min.mjs +1 -1
- package/round.min.mjs.map +1 -1
- package/round.mjs +5 -4
- package/roundToString.cjs +35 -7
- package/roundToString.min.cjs +1 -1
- package/roundToString.min.cjs.map +1 -1
- package/roundToString.min.mjs +1 -1
- package/roundToString.min.mjs.map +1 -1
- package/roundToString.mjs +5 -4
- package/safeBtoa.cjs +27 -4
- package/safeBtoa.min.cjs +1 -1
- package/safeBtoa.min.cjs.map +1 -1
- package/safeBtoa.min.mjs +1 -1
- package/safeBtoa.min.mjs.map +1 -1
- package/safeBtoa.mjs +0 -2
- package/sha256.cjs +34 -8
- package/sha256.min.cjs +1 -1
- package/sha256.min.cjs.map +1 -1
- package/sha256.min.mjs +1 -1
- package/sha256.min.mjs.map +1 -1
- package/sha256.mjs +7 -6
- package/sleep.cjs +27 -4
- package/sleep.min.cjs +1 -1
- package/sleep.min.cjs.map +1 -1
- package/sleep.min.mjs +1 -1
- package/sleep.min.mjs.map +1 -1
- package/sleep.mjs +0 -2
- package/storageAdapter.cjs +18 -1
- package/storageAdapter.min.cjs +2 -1
- package/storageAdapter.min.cjs.map +1 -1
- package/sum.cjs +45 -5
- package/sum.min.cjs +1 -1
- package/sum.min.cjs.map +1 -1
- package/sum.min.mjs +1 -1
- package/sum.min.mjs.map +1 -1
- package/sum.mjs +18 -5
- package/timeConstants.cjs +69 -35
- package/timeConstants.min.cjs +1 -1
- package/timeConstants.min.cjs.map +1 -1
- package/timeConstants.min.mjs +1 -1
- package/timeConstants.min.mjs.map +1 -1
- package/timeConstants.mjs +15 -19
- package/timer.cjs +180 -7
- package/timer.min.cjs +1 -1
- package/timer.min.cjs.map +1 -1
- package/timer.min.mjs +1 -1
- package/timer.min.mjs.map +1 -1
- package/timer.mjs +154 -8
- package/toReadableString.cjs +68 -6
- package/toReadableString.min.cjs +5 -1
- package/toReadableString.min.cjs.map +1 -1
- package/toReadableString.min.mjs +5 -1
- package/toReadableString.min.mjs.map +1 -1
- package/toReadableString.mjs +41 -4
- package/chunk-22JDWCOS.min.cjs +0 -2
- package/chunk-22JDWCOS.min.cjs.map +0 -1
- package/chunk-244NBT4Q.min.mjs +0 -2
- package/chunk-244NBT4Q.min.mjs.map +0 -1
- package/chunk-27MBP3ES.min.cjs +0 -2
- package/chunk-27MBP3ES.min.cjs.map +0 -1
- package/chunk-34ENP2B3.min.mjs +0 -438
- package/chunk-34ENP2B3.min.mjs.map +0 -1
- package/chunk-3EBQ2GO2.min.cjs +0 -2
- package/chunk-3EBQ2GO2.min.cjs.map +0 -1
- package/chunk-4GLOLTJ5.cjs +0 -167
- package/chunk-6TQBMXTL.min.cjs +0 -2
- package/chunk-6TQBMXTL.min.cjs.map +0 -1
- package/chunk-AWZBCFMG.min.cjs +0 -2
- package/chunk-AWZBCFMG.min.cjs.map +0 -1
- package/chunk-AXNETZET.cjs +0 -20
- package/chunk-BKZM6NWX.min.cjs +0 -2
- package/chunk-BKZM6NWX.min.cjs.map +0 -1
- package/chunk-BZKQXX3A.cjs +0 -40
- package/chunk-CERFUU5I.cjs +0 -93
- package/chunk-CSTKFJ6G.mjs +0 -239
- package/chunk-DUN4UY2Q.cjs +0 -239
- package/chunk-EDJJUP4K.min.cjs +0 -6
- package/chunk-EDJJUP4K.min.cjs.map +0 -1
- package/chunk-FFNQBZH5.cjs +0 -14
- package/chunk-FZZRSHSH.min.mjs +0 -6
- package/chunk-FZZRSHSH.min.mjs.map +0 -1
- package/chunk-GAP2HS5M.min.cjs +0 -2
- package/chunk-GAP2HS5M.min.cjs.map +0 -1
- package/chunk-GLYMAPS4.min.mjs +0 -2
- package/chunk-GLYMAPS4.min.mjs.map +0 -1
- package/chunk-I65KPVMO.min.cjs +0 -438
- package/chunk-I65KPVMO.min.cjs.map +0 -1
- package/chunk-ILGTU46T.cjs +0 -39
- package/chunk-IOKRXHKE.min.mjs +0 -2
- package/chunk-IOKRXHKE.min.mjs.map +0 -1
- package/chunk-ISP4SMRC.min.cjs +0 -2
- package/chunk-ISP4SMRC.min.cjs.map +0 -1
- package/chunk-KETP5HBF.cjs +0 -24
- package/chunk-KLHNGJ4Y.min.mjs +0 -2
- package/chunk-KLHNGJ4Y.min.mjs.map +0 -1
- package/chunk-KMNTU3DJ.mjs +0 -45
- package/chunk-LDVEXETI.cjs +0 -45
- package/chunk-LZENHV35.min.cjs +0 -2
- package/chunk-LZENHV35.min.cjs.map +0 -1
- package/chunk-M5PIM2HB.mjs +0 -42
- package/chunk-M6PYQYOX.mjs +0 -39
- package/chunk-MN5EYNZN.min.mjs +0 -2
- package/chunk-MN5EYNZN.min.mjs.map +0 -1
- package/chunk-NRIBJ2OJ.mjs +0 -16031
- package/chunk-NVLYXWLX.cjs +0 -32
- package/chunk-O352F2MT.mjs +0 -24
- package/chunk-O6B2TKFK.min.mjs +0 -2
- package/chunk-O6B2TKFK.min.mjs.map +0 -1
- package/chunk-OGF34H4T.min.cjs +0 -2
- package/chunk-OGF34H4T.min.cjs.map +0 -1
- package/chunk-OXSWWWOM.min.mjs +0 -2
- package/chunk-OXSWWWOM.min.mjs.map +0 -1
- package/chunk-PRUGHVRT.mjs +0 -14
- package/chunk-Q4WCMSOW.min.mjs +0 -2
- package/chunk-Q4WCMSOW.min.mjs.map +0 -1
- package/chunk-QH74JZCK.mjs +0 -9
- package/chunk-QNNJNLGK.min.cjs +0 -2
- package/chunk-QNNJNLGK.min.cjs.map +0 -1
- package/chunk-QWCFN7ZM.mjs +0 -15
- package/chunk-SDM2OPT6.mjs +0 -32
- package/chunk-SHKRZCF2.cjs +0 -16031
- package/chunk-SJDJDNDN.min.cjs +0 -2
- package/chunk-SJDJDNDN.min.cjs.map +0 -1
- package/chunk-SULNMALN.cjs +0 -328
- package/chunk-SV35RBZ7.min.mjs +0 -2
- package/chunk-SV35RBZ7.min.mjs.map +0 -1
- package/chunk-TJFYGFOW.mjs +0 -328
- package/chunk-UHRYBUUX.min.mjs +0 -2
- package/chunk-UHRYBUUX.min.mjs.map +0 -1
- package/chunk-UOU6IP3S.min.mjs +0 -2
- package/chunk-UOU6IP3S.min.mjs.map +0 -1
- package/chunk-V76XVNZ5.mjs +0 -20
- package/chunk-VFYQ7I5V.min.mjs +0 -2
- package/chunk-VFYQ7I5V.min.mjs.map +0 -1
- package/chunk-VG7VV7J2.mjs +0 -167
- package/chunk-VJCV56DO.cjs +0 -15
- package/chunk-VREA6AKG.cjs +0 -9
- package/chunk-W5I6Y5FK.min.mjs +0 -2
- package/chunk-W5I6Y5FK.min.mjs.map +0 -1
- package/chunk-Y7MC73BZ.cjs +0 -42
- package/chunk-YVWROQKU.mjs +0 -40
- package/chunk-ZKIZ5SWK.min.cjs +0 -2
- package/chunk-ZKIZ5SWK.min.cjs.map +0 -1
- package/chunk-ZZZB7NJX.mjs +0 -93
- package/magic-string.es-4UY437WL.min.mjs +0 -14
- package/magic-string.es-4UY437WL.min.mjs.map +0 -1
- package/magic-string.es-OAQWZQTY.mjs +0 -1323
- package/magic-string.es-UE2UVQEL.cjs +0 -1323
- package/magic-string.es-X6DNUB6Y.min.cjs +0 -14
- package/magic-string.es-X6DNUB6Y.min.cjs.map +0 -1
package/arrayBuffer.cjs
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
// src/arrayBuffer.ts
|
|
21
|
+
var arrayBuffer_exports = {};
|
|
22
|
+
__export(arrayBuffer_exports, {
|
|
23
|
+
arrayBufferToBase64: () => arrayBufferToBase64,
|
|
24
|
+
arrayBufferToHex: () => arrayBufferToHex
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(arrayBuffer_exports);
|
|
27
|
+
function arrayBufferToHex(buffer) {
|
|
28
|
+
const byteArray = new Uint8Array(buffer);
|
|
29
|
+
return Array.from(byteArray).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
30
|
+
}
|
|
31
|
+
function arrayBufferToBase64(buffer) {
|
|
32
|
+
const byteArray = new Uint8Array(buffer);
|
|
33
|
+
const binaryString = Array.from(byteArray).map((byte) => String.fromCodePoint(byte)).join("");
|
|
34
|
+
return btoa(binaryString);
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
arrayBufferToBase64,
|
|
39
|
+
arrayBufferToHex
|
|
40
|
+
});
|
package/arrayBuffer.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(
|
|
1
|
+
"use strict";var e=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var u=(t,r)=>{for(var n in r)e(t,n,{get:r[n],enumerable:!0})},A=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of i(r))!y.call(t,a)&&a!==n&&e(t,a,{get:()=>r[a],enumerable:!(o=f(r,a))||o.enumerable});return t};var s=t=>A(e({},"__esModule",{value:!0}),t);var m={};u(m,{arrayBufferToBase64:()=>g,arrayBufferToHex:()=>c});module.exports=s(m);function c(t){let r=new Uint8Array(t);return Array.from(r).map(n=>n.toString(16).padStart(2,"0")).join("")}function g(t){let r=new Uint8Array(t),n=Array.from(r).map(o=>String.fromCodePoint(o)).join("");return btoa(n)}0&&(module.exports={arrayBufferToBase64,arrayBufferToHex});
|
|
2
2
|
//# sourceMappingURL=arrayBuffer.min.cjs.map
|
package/arrayBuffer.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/arrayBuffer.ts"],"sourcesContent":["/**\n * Encode an input ArrayBuffer into a hex string.\n */\nexport function arrayBufferToHex(buffer: ArrayBuffer): string {\n // Create a Uint8Array view of the ArrayBuffer\n const byteArray = new Uint8Array(buffer);\n\n // Convert each byte to a two-character hexadecimal string\n return Array.from(byteArray)\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n\n/**\n * Encode an input ArrayBuffer into a base64 string.\n */\nexport function arrayBufferToBase64(buffer: ArrayBuffer): string {\n // Convert the ArrayBuffer to a Uint8Array\n const byteArray = new Uint8Array(buffer);\n\n // Create a binary string from the byte array\n const binaryString = Array.from(byteArray)\n .map((byte) => String.fromCodePoint(byte))\n .join(\"\");\n\n // Encode the binary string to base64. No need to use safeBtoa because we\n // already simplified the binary input above.\n return btoa(binaryString);\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,qBAAAC,IAAA,eAAAC,EAAAJ,GAGO,SAASG,EAAiBE,EAA6B,CAE5D,IAAMC,EAAY,IAAI,WAAWD,CAAM,EAGvC,OAAO,MAAM,KAAKC,CAAS,EACxB,IAAKC,GAASA,EAAK,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,CAAC,EAChD,KAAK,EAAE,CACZ,CAKO,SAASL,EAAoBG,EAA6B,CAE/D,IAAMC,EAAY,IAAI,WAAWD,CAAM,EAGjCG,EAAe,MAAM,KAAKF,CAAS,EACtC,IAAKC,GAAS,OAAO,cAAcA,CAAI,CAAC,EACxC,KAAK,EAAE,EAIV,OAAO,KAAKC,CAAY,CAC1B","names":["arrayBuffer_exports","__export","arrayBufferToBase64","arrayBufferToHex","__toCommonJS","buffer","byteArray","byte","binaryString"]}
|
package/arrayBuffer.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function o(r){let t=new Uint8Array(r);return Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join("")}function e(r){let t=new Uint8Array(r),n=Array.from(t).map(a=>String.fromCodePoint(a)).join("");return btoa(n)}export{e as arrayBufferToBase64,o as arrayBufferToHex};
|
|
2
2
|
//# sourceMappingURL=arrayBuffer.min.mjs.map
|
package/arrayBuffer.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/arrayBuffer.ts"],"sourcesContent":["/**\n * Encode an input ArrayBuffer into a hex string.\n */\nexport function arrayBufferToHex(buffer: ArrayBuffer): string {\n // Create a Uint8Array view of the ArrayBuffer\n const byteArray = new Uint8Array(buffer);\n\n // Convert each byte to a two-character hexadecimal string\n return Array.from(byteArray)\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n\n/**\n * Encode an input ArrayBuffer into a base64 string.\n */\nexport function arrayBufferToBase64(buffer: ArrayBuffer): string {\n // Convert the ArrayBuffer to a Uint8Array\n const byteArray = new Uint8Array(buffer);\n\n // Create a binary string from the byte array\n const binaryString = Array.from(byteArray)\n .map((byte) => String.fromCodePoint(byte))\n .join(\"\");\n\n // Encode the binary string to base64. No need to use safeBtoa because we\n // already simplified the binary input above.\n return btoa(binaryString);\n}\n"],"mappings":"AAGO,SAASA,EAAiBC,EAA6B,CAE5D,IAAMC,EAAY,IAAI,WAAWD,CAAM,EAGvC,OAAO,MAAM,KAAKC,CAAS,EACxB,IAAKC,GAASA,EAAK,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,CAAC,EAChD,KAAK,EAAE,CACZ,CAKO,SAASC,EAAoBH,EAA6B,CAE/D,IAAMC,EAAY,IAAI,WAAWD,CAAM,EAGjCI,EAAe,MAAM,KAAKH,CAAS,EACtC,IAAKC,GAAS,OAAO,cAAcA,CAAI,CAAC,EACxC,KAAK,EAAE,EAIV,OAAO,KAAKE,CAAY,CAC1B","names":["arrayBufferToHex","buffer","byteArray","byte","arrayBufferToBase64","binaryString"]}
|
package/arrayBuffer.mjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
// src/arrayBuffer.ts
|
|
2
|
+
function arrayBufferToHex(buffer) {
|
|
3
|
+
const byteArray = new Uint8Array(buffer);
|
|
4
|
+
return Array.from(byteArray).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
5
|
+
}
|
|
6
|
+
function arrayBufferToBase64(buffer) {
|
|
7
|
+
const byteArray = new Uint8Array(buffer);
|
|
8
|
+
const binaryString = Array.from(byteArray).map((byte) => String.fromCodePoint(byte)).join("");
|
|
9
|
+
return btoa(binaryString);
|
|
10
|
+
}
|
|
8
11
|
export {
|
|
9
12
|
arrayBufferToBase64,
|
|
10
13
|
arrayBufferToHex
|
package/asNumber.cjs
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
// src/asNumber.ts
|
|
21
|
+
var asNumber_exports = {};
|
|
22
|
+
__export(asNumber_exports, {
|
|
23
|
+
asNumber: () => asNumber
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(asNumber_exports);
|
|
26
|
+
function asNumber(u, defaultValue = 0) {
|
|
27
|
+
if (typeof u === "number") {
|
|
28
|
+
return isFinite(u) ? u : defaultValue;
|
|
29
|
+
}
|
|
30
|
+
u = Number(u);
|
|
31
|
+
if (typeof u === "number" && isFinite(u)) {
|
|
32
|
+
return u;
|
|
33
|
+
}
|
|
34
|
+
return defaultValue;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
asNumber
|
|
39
|
+
});
|
package/asNumber.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(
|
|
1
|
+
"use strict";var t=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var i in r)t(n,i,{get:r[i],enumerable:!0})},s=(n,r,i,b)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of o(r))!f.call(n,e)&&e!==i&&t(n,e,{get:()=>r[e],enumerable:!(b=m(r,e))||b.enumerable});return n};var y=n=>s(t({},"__esModule",{value:!0}),n);var N={};p(N,{asNumber:()=>F});module.exports=y(N);function F(n,r=0){return typeof n=="number"?isFinite(n)?n:r:(n=Number(n),typeof n=="number"&&isFinite(n)?n:r)}0&&(module.exports={asNumber});
|
|
2
2
|
//# sourceMappingURL=asNumber.min.cjs.map
|
package/asNumber.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/asNumber.ts"],"sourcesContent":["/**\n * Coerce `u` into a number if possible, otherwise just return 0.\n */\nexport function asNumber(u: unknown, defaultValue = 0): number {\n // If u is a valid number, return it.\n if (typeof u === \"number\") {\n return isFinite(u) ? u : defaultValue;\n }\n\n // Try to make into a number if not already a number.\n u = Number(u);\n\n // If u is a valid number, return it.\n if (typeof u === \"number\" && isFinite(u)) {\n return u;\n }\n\n // Return `defaultValue` for everything else. This is usually ok if want to\n // just ignore all other noise.\n return defaultValue;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAGO,SAASE,EAASE,EAAYC,EAAe,EAAW,CAE7D,OAAI,OAAOD,GAAM,SACR,SAASA,CAAC,EAAIA,EAAIC,GAI3BD,EAAI,OAAOA,CAAC,EAGR,OAAOA,GAAM,UAAY,SAASA,CAAC,EAC9BA,EAKFC,EACT","names":["asNumber_exports","__export","asNumber","__toCommonJS","u","defaultValue"]}
|
package/asNumber.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function e(n,r=0){return typeof n=="number"?isFinite(n)?n:r:(n=Number(n),typeof n=="number"&&isFinite(n)?n:r)}export{e as asNumber};
|
|
2
2
|
//# sourceMappingURL=asNumber.min.mjs.map
|
package/asNumber.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/asNumber.ts"],"sourcesContent":["/**\n * Coerce `u` into a number if possible, otherwise just return 0.\n */\nexport function asNumber(u: unknown, defaultValue = 0): number {\n // If u is a valid number, return it.\n if (typeof u === \"number\") {\n return isFinite(u) ? u : defaultValue;\n }\n\n // Try to make into a number if not already a number.\n u = Number(u);\n\n // If u is a valid number, return it.\n if (typeof u === \"number\" && isFinite(u)) {\n return u;\n }\n\n // Return `defaultValue` for everything else. This is usually ok if want to\n // just ignore all other noise.\n return defaultValue;\n}\n"],"mappings":"AAGO,SAASA,EAASC,EAAYC,EAAe,EAAW,CAE7D,OAAI,OAAOD,GAAM,SACR,SAASA,CAAC,EAAIA,EAAIC,GAI3BD,EAAI,OAAOA,CAAC,EAGR,OAAOA,GAAM,UAAY,SAASA,CAAC,EAC9BA,EAKFC,EACT","names":["asNumber","u","defaultValue"]}
|
package/asNumber.mjs
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/asNumber.ts
|
|
2
|
+
function asNumber(u, defaultValue = 0) {
|
|
3
|
+
if (typeof u === "number") {
|
|
4
|
+
return isFinite(u) ? u : defaultValue;
|
|
5
|
+
}
|
|
6
|
+
u = Number(u);
|
|
7
|
+
if (typeof u === "number" && isFinite(u)) {
|
|
8
|
+
return u;
|
|
9
|
+
}
|
|
10
|
+
return defaultValue;
|
|
11
|
+
}
|
|
5
12
|
export {
|
|
6
13
|
asNumber
|
|
7
14
|
};
|
package/assert.cjs
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
20
|
// src/assert.ts
|
|
21
|
+
var assert_exports = {};
|
|
22
|
+
__export(assert_exports, {
|
|
23
|
+
assert: () => assert
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(assert_exports);
|
|
4
26
|
function assert(t, errorMessage) {
|
|
5
27
|
if (!t) {
|
|
6
28
|
throw new Error(
|
|
@@ -8,6 +30,7 @@ function assert(t, errorMessage) {
|
|
|
8
30
|
);
|
|
9
31
|
}
|
|
10
32
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
assert
|
|
36
|
+
});
|
package/assert.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(
|
|
1
|
+
"use strict";var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var l=(e,s)=>{for(var n in s)r(e,n,{get:s[n],enumerable:!0})},d=(e,s,n,t)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of a(s))!o.call(e,i)&&i!==n&&r(e,i,{get:()=>s[i],enumerable:!(t=f(s,i))||t.enumerable});return e};var u=e=>d(r({},"__esModule",{value:!0}),e);var N={};l(N,{assert:()=>y});module.exports=u(N);function y(e,s){if(!e)throw new Error(s||`Assertion failed: ${JSON.stringify(e)} is falsy`)}0&&(module.exports={assert});
|
|
2
2
|
//# sourceMappingURL=assert.min.cjs.map
|
package/assert.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/assert.ts"],"sourcesContent":["/**\n * Type asserts that `t` is truthy. Throws an error with `errorMessage` if\n * `t` is falsy.\n */\nexport function assert<T>(\n t: T | null | undefined | \"\" | 0 | -0 | 0n | false | typeof NaN,\n errorMessage?: string,\n): asserts t is T {\n if (!t) {\n throw new Error(\n errorMessage || `Assertion failed: ${JSON.stringify(t)} is falsy`,\n );\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,IAAA,eAAAC,EAAAH,GAIO,SAASE,EACdE,EACAC,EACgB,CAChB,GAAI,CAACD,EACH,MAAM,IAAI,MACRC,GAAgB,qBAAqB,KAAK,UAAUD,CAAC,CAAC,WACxD,CAEJ","names":["assert_exports","__export","assert","__toCommonJS","t","errorMessage"]}
|
package/assert.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function i(s,e){if(!s)throw new Error(e||`Assertion failed: ${JSON.stringify(s)} is falsy`)}export{i as assert};
|
|
2
2
|
//# sourceMappingURL=assert.min.mjs.map
|
package/assert.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/assert.ts"],"sourcesContent":["/**\n * Type asserts that `t` is truthy. Throws an error with `errorMessage` if\n * `t` is falsy.\n */\nexport function assert<T>(\n t: T | null | undefined | \"\" | 0 | -0 | 0n | false | typeof NaN,\n errorMessage?: string,\n): asserts t is T {\n if (!t) {\n throw new Error(\n errorMessage || `Assertion failed: ${JSON.stringify(t)} is falsy`,\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/assert.ts"],"sourcesContent":["/**\n * Type asserts that `t` is truthy. Throws an error with `errorMessage` if\n * `t` is falsy.\n */\nexport function assert<T>(\n t: T | null | undefined | \"\" | 0 | -0 | 0n | false | typeof NaN,\n errorMessage?: string,\n): asserts t is T {\n if (!t) {\n throw new Error(\n errorMessage || `Assertion failed: ${JSON.stringify(t)} is falsy`,\n );\n }\n}\n"],"mappings":"AAIO,SAASA,EACdC,EACAC,EACgB,CAChB,GAAI,CAACD,EACH,MAAM,IAAI,MACRC,GAAgB,qBAAqB,KAAK,UAAUD,CAAC,CAAC,WACxD,CAEJ","names":["assert","t","errorMessage"]}
|
package/assert.mjs
CHANGED
package/base64Url.cjs
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
20
|
// src/base64Url.ts
|
|
21
|
+
var base64Url_exports = {};
|
|
22
|
+
__export(base64Url_exports, {
|
|
23
|
+
base64ToBase64URL: () => base64ToBase64URL,
|
|
24
|
+
base64UrlToBase64: () => base64UrlToBase64
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(base64Url_exports);
|
|
4
27
|
function base64ToBase64URL(base64) {
|
|
5
28
|
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
6
29
|
}
|
|
@@ -10,7 +33,8 @@ function base64UrlToBase64(base64Url) {
|
|
|
10
33
|
const padLength = (4 - base64.length % 4) % 4;
|
|
11
34
|
return base64 + "=".repeat(padLength);
|
|
12
35
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
base64ToBase64URL,
|
|
39
|
+
base64UrlToBase64
|
|
40
|
+
});
|
package/base64Url.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(
|
|
1
|
+
"use strict";var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var o=(e,r)=>{for(var t in r)a(e,t,{get:r[t],enumerable:!0})},i=(e,r,t,g)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of c(r))!p.call(e,n)&&n!==t&&a(e,n,{get:()=>r[n],enumerable:!(g=s(r,n))||g.enumerable});return e};var l=e=>i(a({},"__esModule",{value:!0}),e);var b={};o(b,{base64ToBase64URL:()=>u,base64UrlToBase64:()=>f});module.exports=l(b);function u(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function f(e){if(!e)return"";let r=e.replace(/-/g,"+").replace(/_/g,"/"),t=(4-r.length%4)%4;return r+"=".repeat(t)}0&&(module.exports={base64ToBase64URL,base64UrlToBase64});
|
|
2
2
|
//# sourceMappingURL=base64Url.min.cjs.map
|
package/base64Url.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/base64Url.ts"],"sourcesContent":["/**\n * Convert a base64 string to a base64url string.\n */\nexport function base64ToBase64URL(base64: string): string {\n return base64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\"); // Remove padding\n}\n\n/**\n * Convert a base64url string to a base64 string.\n */\nexport function base64UrlToBase64(base64Url: string): string {\n if (!base64Url) return \"\";\n\n // Replace URL-safe characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n // Calculate and add padding\n const padLength = (4 - (base64.length % 4)) % 4;\n return base64 + \"=\".repeat(padLength);\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,EAAA,sBAAAC,IAAA,eAAAC,EAAAJ,GAGO,SAASE,EAAkBG,EAAwB,CACxD,OAAOA,EAAO,QAAQ,MAAO,GAAG,EAAE,QAAQ,MAAO,GAAG,EAAE,QAAQ,MAAO,EAAE,CACzE,CAKO,SAASF,EAAkBG,EAA2B,CAC3D,GAAI,CAACA,EAAW,MAAO,GAGvB,IAAMD,EAASC,EAAU,QAAQ,KAAM,GAAG,EAAE,QAAQ,KAAM,GAAG,EAGvDC,GAAa,EAAKF,EAAO,OAAS,GAAM,EAC9C,OAAOA,EAAS,IAAI,OAAOE,CAAS,CACtC","names":["base64Url_exports","__export","base64ToBase64URL","base64UrlToBase64","__toCommonJS","base64","base64Url","padLength"]}
|
package/base64Url.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function n(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function a(e){if(!e)return"";let r=e.replace(/-/g,"+").replace(/_/g,"/"),t=(4-r.length%4)%4;return r+"=".repeat(t)}export{n as base64ToBase64URL,a as base64UrlToBase64};
|
|
2
2
|
//# sourceMappingURL=base64Url.min.mjs.map
|
package/base64Url.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/base64Url.ts"],"sourcesContent":["/**\n * Convert a base64 string to a base64url string.\n */\nexport function base64ToBase64URL(base64: string): string {\n return base64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\"); // Remove padding\n}\n\n/**\n * Convert a base64url string to a base64 string.\n */\nexport function base64UrlToBase64(base64Url: string): string {\n if (!base64Url) return \"\";\n\n // Replace URL-safe characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n // Calculate and add padding\n const padLength = (4 - (base64.length % 4)) % 4;\n return base64 + \"=\".repeat(padLength);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/base64Url.ts"],"sourcesContent":["/**\n * Convert a base64 string to a base64url string.\n */\nexport function base64ToBase64URL(base64: string): string {\n return base64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\"); // Remove padding\n}\n\n/**\n * Convert a base64url string to a base64 string.\n */\nexport function base64UrlToBase64(base64Url: string): string {\n if (!base64Url) return \"\";\n\n // Replace URL-safe characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n // Calculate and add padding\n const padLength = (4 - (base64.length % 4)) % 4;\n return base64 + \"=\".repeat(padLength);\n}\n"],"mappings":"AAGO,SAASA,EAAkBC,EAAwB,CACxD,OAAOA,EAAO,QAAQ,MAAO,GAAG,EAAE,QAAQ,MAAO,GAAG,EAAE,QAAQ,MAAO,EAAE,CACzE,CAKO,SAASC,EAAkBC,EAA2B,CAC3D,GAAI,CAACA,EAAW,MAAO,GAGvB,IAAMF,EAASE,EAAU,QAAQ,KAAM,GAAG,EAAE,QAAQ,KAAM,GAAG,EAGvDC,GAAa,EAAKH,EAAO,OAAS,GAAM,EAC9C,OAAOA,EAAS,IAAI,OAAOG,CAAS,CACtC","names":["base64ToBase64URL","base64","base64UrlToBase64","base64Url","padLength"]}
|
package/base64Url.mjs
CHANGED
package/capLength.cjs
CHANGED
|
@@ -1,16 +1,80 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/capLength.ts
|
|
21
|
+
var capLength_exports = {};
|
|
22
|
+
__export(capLength_exports, {
|
|
23
|
+
capLength: () => capLength
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(capLength_exports);
|
|
2
26
|
|
|
3
|
-
|
|
4
|
-
|
|
27
|
+
// src/toReadableString.ts
|
|
28
|
+
function toReadableString(u, options) {
|
|
29
|
+
if (typeof u === "string") {
|
|
30
|
+
return u;
|
|
31
|
+
}
|
|
32
|
+
if (u instanceof Error) {
|
|
33
|
+
const error = u;
|
|
34
|
+
let result = "";
|
|
35
|
+
const errorName = error.name || "Error";
|
|
36
|
+
const errorMessage = error.message || "An error occurred with no message provided.";
|
|
37
|
+
result += `${errorName}: ${errorMessage}`;
|
|
38
|
+
if (options?.includeStack && error.stack) {
|
|
39
|
+
const stack = error.stack.replace(new RegExp(`^${errorName}:.*\\n?`), "").trim();
|
|
40
|
+
if (stack) {
|
|
41
|
+
result += `
|
|
42
|
+
Stack Trace:
|
|
43
|
+
${stack}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (options?.includeErrorProps) {
|
|
47
|
+
const customProps = error;
|
|
48
|
+
const additionalInfo = Object.keys(customProps).filter(
|
|
49
|
+
(key) => key !== "name" && key !== "message" && key !== "stack" && typeof customProps[key] !== "function" && typeof customProps[key] !== "object"
|
|
50
|
+
).map((key) => `
|
|
51
|
+
- ${key}: ${customProps[key]}`);
|
|
52
|
+
if (additionalInfo.length > 0) {
|
|
53
|
+
result += `
|
|
54
|
+
Additional Data:${additionalInfo.join("")}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
if (u !== null && typeof u === "object" && u.toString !== Object.prototype.toString) {
|
|
60
|
+
return u.toString();
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return JSON.stringify(u);
|
|
64
|
+
} catch {
|
|
65
|
+
return String(u);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
5
68
|
|
|
6
69
|
// src/capLength.ts
|
|
7
70
|
function capLength(u, maxLength = 400) {
|
|
8
|
-
const s =
|
|
71
|
+
const s = toReadableString(u);
|
|
9
72
|
if (s.length <= maxLength) {
|
|
10
73
|
return s;
|
|
11
74
|
}
|
|
12
75
|
return s.slice(0, maxLength) + ` ... (${s.length - maxLength} more)`;
|
|
13
76
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
capLength
|
|
80
|
+
});
|
package/capLength.min.cjs
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(
|
|
1
|
+
"use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var u=(r,t)=>{for(var n in t)s(r,n,{get:t[n],enumerable:!0})},m=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!d.call(r,e)&&e!==n&&s(r,e,{get:()=>t[e],enumerable:!(i=g(t,e))||i.enumerable});return r};var S=r=>m(s({},"__esModule",{value:!0}),r);var $={};u($,{capLength:()=>b});module.exports=S($);function f(r,t){if(typeof r=="string")return r;if(r instanceof Error){let n=r,i="",e=n.name||"Error",l=n.message||"An error occurred with no message provided.";if(i+=`${e}: ${l}`,t?.includeStack&&n.stack){let c=n.stack.replace(new RegExp(`^${e}:.*\\n?`),"").trim();c&&(i+=`
|
|
2
|
+
Stack Trace:
|
|
3
|
+
${c}`)}if(t?.includeErrorProps){let c=n,a=Object.keys(c).filter(o=>o!=="name"&&o!=="message"&&o!=="stack"&&typeof c[o]!="function"&&typeof c[o]!="object").map(o=>`
|
|
4
|
+
- ${o}: ${c[o]}`);a.length>0&&(i+=`
|
|
5
|
+
Additional Data:${a.join("")}`)}return i}if(r!==null&&typeof r=="object"&&r.toString!==Object.prototype.toString)return r.toString();try{return JSON.stringify(r)}catch{return String(r)}}function b(r,t=400){let n=f(r);return n.length<=t?n:n.slice(0,t)+` ... (${n.length-t} more)`}0&&(module.exports={capLength});
|
|
2
6
|
//# sourceMappingURL=capLength.min.cjs.map
|
package/capLength.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/capLength.ts","../src/toReadableString.ts"],"sourcesContent":["import { toReadableString } from \"./toReadableString\";\n\nexport function capLength(u: unknown, maxLength = 400): string {\n const s = toReadableString(u);\n\n if (s.length <= maxLength) {\n return s;\n }\n\n return s.slice(0, maxLength) + ` ... (${s.length - maxLength} more)`;\n}\n","/**\n * Make the given argument of unknown type into something human-readable.\n * For Error objects, you can specify options to make the string more verbose.\n */\nexport function toReadableString(\n u: unknown,\n options?: { includeStack?: boolean; includeErrorProps?: boolean },\n): string {\n if (typeof u === \"string\") {\n return u;\n }\n\n if (u instanceof Error) {\n const error = u as Error;\n let result = \"\";\n\n // Always include the name and message\n const errorName = error.name || \"Error\";\n const errorMessage =\n error.message || \"An error occurred with no message provided.\";\n\n result += `${errorName}: ${errorMessage}`;\n\n // Optionally include the stack trace\n if (options?.includeStack && error.stack) {\n // Clean up the stack trace to start on a new line,\n // removing potential duplicate header lines if the browser adds them.\n const stack = error.stack\n // Remove the first line if it duplicates the name/message\n .replace(new RegExp(`^${errorName}:.*\\\\n?`), \"\")\n .trim();\n\n if (stack) {\n result += `\\nStack Trace:\\n${stack}`;\n }\n }\n\n // Add any potential custom error properties (e.g., HTTP status code)\n if (options?.includeErrorProps) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const customProps: { [key: string]: unknown } = error as any;\n\n const additionalInfo = Object.keys(customProps)\n .filter(\n (key) =>\n key !== \"name\" &&\n key !== \"message\" &&\n key !== \"stack\" &&\n typeof customProps[key] !== \"function\" &&\n typeof customProps[key] !== \"object\",\n )\n .map((key) => `\\n- ${key}: ${customProps[key]}`);\n\n if (additionalInfo.length > 0) {\n result += `\\nAdditional Data:${additionalInfo.join(\"\")}`;\n }\n }\n\n return result;\n }\n\n // If the object has a custom toString(), then use it.\n if (\n u !== null &&\n typeof u === \"object\" &&\n u.toString !== Object.prototype.toString\n ) {\n return u.toString();\n }\n\n try {\n // Attempt to JSON stringify the object for inspection.\n return JSON.stringify(u);\n } catch {\n // Fallback if the object cannot be stringified (e.g., circular references).\n return String(u);\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GCIO,SAASI,EACdC,EACAC,EACQ,CACR,GAAI,OAAOD,GAAM,SACf,OAAOA,EAGT,GAAIA,aAAa,MAAO,CACtB,IAAME,EAAQF,EACVG,EAAS,GAGPC,EAAYF,EAAM,MAAQ,QAC1BG,EACJH,EAAM,SAAW,8CAKnB,GAHAC,GAAU,GAAGC,CAAS,KAAKC,CAAY,GAGnCJ,GAAS,cAAgBC,EAAM,MAAO,CAGxC,IAAMI,EAAQJ,EAAM,MAEjB,QAAQ,IAAI,OAAO,IAAIE,CAAS,SAAS,EAAG,EAAE,EAC9C,KAAK,EAEJE,IACFH,GAAU;AAAA;AAAA,EAAmBG,CAAK,GAEtC,CAGA,GAAIL,GAAS,kBAAmB,CAE9B,IAAMM,EAA0CL,EAE1CM,EAAiB,OAAO,KAAKD,CAAW,EAC3C,OACEE,GACCA,IAAQ,QACRA,IAAQ,WACRA,IAAQ,SACR,OAAOF,EAAYE,CAAG,GAAM,YAC5B,OAAOF,EAAYE,CAAG,GAAM,QAChC,EACC,IAAKA,GAAQ;AAAA,IAAOA,CAAG,KAAKF,EAAYE,CAAG,CAAC,EAAE,EAE7CD,EAAe,OAAS,IAC1BL,GAAU;AAAA,kBAAqBK,EAAe,KAAK,EAAE,CAAC,GAE1D,CAEA,OAAOL,CACT,CAGA,GACEH,IAAM,MACN,OAAOA,GAAM,UACbA,EAAE,WAAa,OAAO,UAAU,SAEhC,OAAOA,EAAE,SAAS,EAGpB,GAAI,CAEF,OAAO,KAAK,UAAUA,CAAC,CACzB,MAAQ,CAEN,OAAO,OAAOA,CAAC,CACjB,CACF,CD3EO,SAASU,EAAUC,EAAYC,EAAY,IAAa,CAC7D,IAAMC,EAAIC,EAAiBH,CAAC,EAE5B,OAAIE,EAAE,QAAUD,EACPC,EAGFA,EAAE,MAAM,EAAGD,CAAS,EAAI,SAASC,EAAE,OAASD,CAAS,QAC9D","names":["capLength_exports","__export","capLength","__toCommonJS","toReadableString","u","options","error","result","errorName","errorMessage","stack","customProps","additionalInfo","key","capLength","u","maxLength","s","toReadableString"]}
|
package/capLength.min.mjs
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
function a(r,o){if(typeof r=="string")return r;if(r instanceof Error){let t=r,i="",c=t.name||"Error",f=t.message||"An error occurred with no message provided.";if(i+=`${c}: ${f}`,o?.includeStack&&t.stack){let e=t.stack.replace(new RegExp(`^${c}:.*\\n?`),"").trim();e&&(i+=`
|
|
2
|
+
Stack Trace:
|
|
3
|
+
${e}`)}if(o?.includeErrorProps){let e=t,s=Object.keys(e).filter(n=>n!=="name"&&n!=="message"&&n!=="stack"&&typeof e[n]!="function"&&typeof e[n]!="object").map(n=>`
|
|
4
|
+
- ${n}: ${e[n]}`);s.length>0&&(i+=`
|
|
5
|
+
Additional Data:${s.join("")}`)}return i}if(r!==null&&typeof r=="object"&&r.toString!==Object.prototype.toString)return r.toString();try{return JSON.stringify(r)}catch{return String(r)}}function p(r,o=400){let t=a(r);return t.length<=o?t:t.slice(0,o)+` ... (${t.length-o} more)`}export{p as capLength};
|
|
2
6
|
//# sourceMappingURL=capLength.min.mjs.map
|
package/capLength.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/capLength.ts"],"sourcesContent":["import { toReadableString } from \"./toReadableString\";\n\nexport function capLength(u: unknown, maxLength = 400): string {\n const s = toReadableString(u);\n\n if (s.length <= maxLength) {\n return s;\n }\n\n return s.slice(0, maxLength) + ` ... (${s.length - maxLength} more)`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/toReadableString.ts","../src/capLength.ts"],"sourcesContent":["/**\n * Make the given argument of unknown type into something human-readable.\n * For Error objects, you can specify options to make the string more verbose.\n */\nexport function toReadableString(\n u: unknown,\n options?: { includeStack?: boolean; includeErrorProps?: boolean },\n): string {\n if (typeof u === \"string\") {\n return u;\n }\n\n if (u instanceof Error) {\n const error = u as Error;\n let result = \"\";\n\n // Always include the name and message\n const errorName = error.name || \"Error\";\n const errorMessage =\n error.message || \"An error occurred with no message provided.\";\n\n result += `${errorName}: ${errorMessage}`;\n\n // Optionally include the stack trace\n if (options?.includeStack && error.stack) {\n // Clean up the stack trace to start on a new line,\n // removing potential duplicate header lines if the browser adds them.\n const stack = error.stack\n // Remove the first line if it duplicates the name/message\n .replace(new RegExp(`^${errorName}:.*\\\\n?`), \"\")\n .trim();\n\n if (stack) {\n result += `\\nStack Trace:\\n${stack}`;\n }\n }\n\n // Add any potential custom error properties (e.g., HTTP status code)\n if (options?.includeErrorProps) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const customProps: { [key: string]: unknown } = error as any;\n\n const additionalInfo = Object.keys(customProps)\n .filter(\n (key) =>\n key !== \"name\" &&\n key !== \"message\" &&\n key !== \"stack\" &&\n typeof customProps[key] !== \"function\" &&\n typeof customProps[key] !== \"object\",\n )\n .map((key) => `\\n- ${key}: ${customProps[key]}`);\n\n if (additionalInfo.length > 0) {\n result += `\\nAdditional Data:${additionalInfo.join(\"\")}`;\n }\n }\n\n return result;\n }\n\n // If the object has a custom toString(), then use it.\n if (\n u !== null &&\n typeof u === \"object\" &&\n u.toString !== Object.prototype.toString\n ) {\n return u.toString();\n }\n\n try {\n // Attempt to JSON stringify the object for inspection.\n return JSON.stringify(u);\n } catch {\n // Fallback if the object cannot be stringified (e.g., circular references).\n return String(u);\n }\n}\n","import { toReadableString } from \"./toReadableString\";\n\nexport function capLength(u: unknown, maxLength = 400): string {\n const s = toReadableString(u);\n\n if (s.length <= maxLength) {\n return s;\n }\n\n return s.slice(0, maxLength) + ` ... (${s.length - maxLength} more)`;\n}\n"],"mappings":"AAIO,SAASA,EACdC,EACAC,EACQ,CACR,GAAI,OAAOD,GAAM,SACf,OAAOA,EAGT,GAAIA,aAAa,MAAO,CACtB,IAAME,EAAQF,EACVG,EAAS,GAGPC,EAAYF,EAAM,MAAQ,QAC1BG,EACJH,EAAM,SAAW,8CAKnB,GAHAC,GAAU,GAAGC,CAAS,KAAKC,CAAY,GAGnCJ,GAAS,cAAgBC,EAAM,MAAO,CAGxC,IAAMI,EAAQJ,EAAM,MAEjB,QAAQ,IAAI,OAAO,IAAIE,CAAS,SAAS,EAAG,EAAE,EAC9C,KAAK,EAEJE,IACFH,GAAU;AAAA;AAAA,EAAmBG,CAAK,GAEtC,CAGA,GAAIL,GAAS,kBAAmB,CAE9B,IAAMM,EAA0CL,EAE1CM,EAAiB,OAAO,KAAKD,CAAW,EAC3C,OACEE,GACCA,IAAQ,QACRA,IAAQ,WACRA,IAAQ,SACR,OAAOF,EAAYE,CAAG,GAAM,YAC5B,OAAOF,EAAYE,CAAG,GAAM,QAChC,EACC,IAAKA,GAAQ;AAAA,IAAOA,CAAG,KAAKF,EAAYE,CAAG,CAAC,EAAE,EAE7CD,EAAe,OAAS,IAC1BL,GAAU;AAAA,kBAAqBK,EAAe,KAAK,EAAE,CAAC,GAE1D,CAEA,OAAOL,CACT,CAGA,GACEH,IAAM,MACN,OAAOA,GAAM,UACbA,EAAE,WAAa,OAAO,UAAU,SAEhC,OAAOA,EAAE,SAAS,EAGpB,GAAI,CAEF,OAAO,KAAK,UAAUA,CAAC,CACzB,MAAQ,CAEN,OAAO,OAAOA,CAAC,CACjB,CACF,CC3EO,SAASU,EAAUC,EAAYC,EAAY,IAAa,CAC7D,IAAMC,EAAIC,EAAiBH,CAAC,EAE5B,OAAIE,EAAE,QAAUD,EACPC,EAGFA,EAAE,MAAM,EAAGD,CAAS,EAAI,SAASC,EAAE,OAASD,CAAS,QAC9D","names":["toReadableString","u","options","error","result","errorName","errorMessage","stack","customProps","additionalInfo","key","capLength","u","maxLength","s","toReadableString"]}
|
package/capLength.mjs
CHANGED
|
@@ -1,7 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/toReadableString.ts
|
|
2
|
+
function toReadableString(u, options) {
|
|
3
|
+
if (typeof u === "string") {
|
|
4
|
+
return u;
|
|
5
|
+
}
|
|
6
|
+
if (u instanceof Error) {
|
|
7
|
+
const error = u;
|
|
8
|
+
let result = "";
|
|
9
|
+
const errorName = error.name || "Error";
|
|
10
|
+
const errorMessage = error.message || "An error occurred with no message provided.";
|
|
11
|
+
result += `${errorName}: ${errorMessage}`;
|
|
12
|
+
if (options?.includeStack && error.stack) {
|
|
13
|
+
const stack = error.stack.replace(new RegExp(`^${errorName}:.*\\n?`), "").trim();
|
|
14
|
+
if (stack) {
|
|
15
|
+
result += `
|
|
16
|
+
Stack Trace:
|
|
17
|
+
${stack}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (options?.includeErrorProps) {
|
|
21
|
+
const customProps = error;
|
|
22
|
+
const additionalInfo = Object.keys(customProps).filter(
|
|
23
|
+
(key) => key !== "name" && key !== "message" && key !== "stack" && typeof customProps[key] !== "function" && typeof customProps[key] !== "object"
|
|
24
|
+
).map((key) => `
|
|
25
|
+
- ${key}: ${customProps[key]}`);
|
|
26
|
+
if (additionalInfo.length > 0) {
|
|
27
|
+
result += `
|
|
28
|
+
Additional Data:${additionalInfo.join("")}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
if (u !== null && typeof u === "object" && u.toString !== Object.prototype.toString) {
|
|
34
|
+
return u.toString();
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return JSON.stringify(u);
|
|
38
|
+
} catch {
|
|
39
|
+
return String(u);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
5
42
|
|
|
6
43
|
// src/capLength.ts
|
|
7
44
|
function capLength(u, maxLength = 400) {
|
package/concatIterators.cjs
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
20
|
// src/concatIterators.ts
|
|
21
|
+
var concatIterators_exports = {};
|
|
22
|
+
__export(concatIterators_exports, {
|
|
23
|
+
concatIterators: () => concatIterators
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(concatIterators_exports);
|
|
4
26
|
function* concatIterators(...iterators) {
|
|
5
27
|
for (const iterator of iterators) {
|
|
6
28
|
yield* iterator;
|
|
7
29
|
}
|
|
8
30
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
concatIterators
|
|
34
|
+
});
|
package/concatIterators.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(
|
|
1
|
+
"use strict";var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var s=(t,o)=>{for(var e in o)n(t,e,{get:o[e],enumerable:!0})},T=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of f(o))!i.call(t,r)&&r!==e&&n(t,r,{get:()=>o[r],enumerable:!(a=c(o,r))||a.enumerable});return t};var d=t=>T(n({},"__esModule",{value:!0}),t);var p={};s(p,{concatIterators:()=>l});module.exports=d(p);function*l(...t){for(let o of t)yield*o}0&&(module.exports={concatIterators});
|
|
2
2
|
//# sourceMappingURL=concatIterators.min.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/concatIterators.ts"],"sourcesContent":["/** Memory-efficient way to concat two or more iterators. */\nexport function* concatIterators<T>(...iterators: Generator<T>[]) {\n for (const iterator of iterators) {\n yield* iterator;\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GACO,SAAUE,KAAsBE,EAA2B,CAChE,QAAWC,KAAYD,EACrB,MAAOC,CAEX","names":["concatIterators_exports","__export","concatIterators","__toCommonJS","iterators","iterator"]}
|
package/concatIterators.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function*r(...o){for(let t of o)yield*t}export{r as concatIterators};
|
|
2
2
|
//# sourceMappingURL=concatIterators.min.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/concatIterators.ts"],"sourcesContent":["/** Memory-efficient way to concat two or more iterators. */\nexport function* concatIterators<T>(...iterators: Generator<T>[]) {\n for (const iterator of iterators) {\n yield* iterator;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/concatIterators.ts"],"sourcesContent":["/** Memory-efficient way to concat two or more iterators. */\nexport function* concatIterators<T>(...iterators: Generator<T>[]) {\n for (const iterator of iterators) {\n yield* iterator;\n }\n}\n"],"mappings":"AACO,SAAUA,KAAsBC,EAA2B,CAChE,QAAWC,KAAYD,EACrB,MAAOC,CAEX","names":["concatIterators","iterators","iterator"]}
|