@choksheak/ts-utils 0.3.3 → 0.3.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/asNumber.cjs +4 -4
- 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 +4 -4
- package/capLength.cjs +80 -0
- package/capLength.d.mts +3 -0
- package/capLength.d.ts +3 -0
- package/capLength.min.cjs +6 -0
- package/capLength.min.cjs.map +1 -0
- package/capLength.min.mjs +6 -0
- package/capLength.min.mjs.map +1 -0
- package/capLength.mjs +53 -0
- package/{iterators.cjs → concatIterators.cjs} +4 -4
- package/{iterators.min.cjs → concatIterators.min.cjs} +1 -1
- package/concatIterators.min.cjs.map +1 -0
- package/{iterators.min.mjs → concatIterators.min.mjs} +1 -1
- package/concatIterators.min.mjs.map +1 -0
- package/{iterators.mjs → concatIterators.mjs} +1 -1
- package/duration.min.cjs +1 -1
- package/duration.min.mjs +1 -1
- package/kvStore.min.cjs +1 -1
- package/kvStore.min.mjs +1 -1
- package/localStore.min.cjs +1 -1
- package/localStore.min.mjs +1 -1
- package/mean.cjs +4 -4
- 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 +4 -4
- package/median.cjs +4 -4
- 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 +4 -4
- package/package.json +66 -49
- package/round.cjs +2 -10
- package/round.d.mts +2 -8
- package/round.d.ts +2 -8
- 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 +1 -8
- package/{logging.cjs → roundToString.cjs} +18 -22
- package/roundToString.d.mts +8 -0
- package/roundToString.d.ts +8 -0
- package/roundToString.min.cjs +2 -0
- package/roundToString.min.cjs.map +1 -0
- package/roundToString.min.mjs +2 -0
- package/roundToString.min.mjs.map +1 -0
- package/roundToString.mjs +16 -0
- package/sum.cjs +4 -4
- 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 +4 -4
- package/timer.min.cjs +1 -1
- package/timer.min.mjs +1 -1
- package/toReadableString.cjs +69 -0
- package/toReadableString.d.mts +10 -0
- package/toReadableString.d.ts +10 -0
- package/toReadableString.min.cjs +6 -0
- package/toReadableString.min.cjs.map +1 -0
- package/toReadableString.min.mjs +6 -0
- package/toReadableString.min.mjs.map +1 -0
- package/toReadableString.mjs +44 -0
- package/average.cjs +0 -55
- package/average.d.mts +0 -7
- package/average.d.ts +0 -7
- package/average.min.cjs +0 -2
- package/average.min.cjs.map +0 -1
- package/average.min.mjs +0 -2
- package/average.min.mjs.map +0 -1
- package/average.mjs +0 -28
- package/iterators.min.cjs.map +0 -1
- package/iterators.min.mjs.map +0 -1
- package/logging.d.mts +0 -4
- package/logging.d.ts +0 -4
- package/logging.min.cjs +0 -2
- package/logging.min.cjs.map +0 -1
- package/logging.min.mjs +0 -2
- package/logging.min.mjs.map +0 -1
- package/logging.mjs +0 -21
- /package/{iterators.d.mts → concatIterators.d.mts} +0 -0
- /package/{iterators.d.ts → concatIterators.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@choksheak/ts-utils",
|
|
3
3
|
"license": "The Unlicense",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.4",
|
|
5
5
|
"description": "Random Typescript utilities with support for full tree-shaking",
|
|
6
6
|
"private": false,
|
|
7
|
+
"sideEffects": false,
|
|
7
8
|
"scripts": {
|
|
8
9
|
"lint": "eslint .",
|
|
9
10
|
"fix": "eslint . --fix",
|
|
@@ -124,19 +125,6 @@
|
|
|
124
125
|
"default": "./assert.cjs"
|
|
125
126
|
}
|
|
126
127
|
},
|
|
127
|
-
"./average": {
|
|
128
|
-
"types": "./average.d.ts",
|
|
129
|
-
"import": {
|
|
130
|
-
"production": "./average.min.mjs",
|
|
131
|
-
"development": "./average.mjs",
|
|
132
|
-
"default": "./average.mjs"
|
|
133
|
-
},
|
|
134
|
-
"require": {
|
|
135
|
-
"production": "./average.min.cjs",
|
|
136
|
-
"development": "./average.cjs",
|
|
137
|
-
"default": "./average.cjs"
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
128
|
"./base64Url": {
|
|
141
129
|
"types": "./base64Url.d.ts",
|
|
142
130
|
"import": {
|
|
@@ -150,6 +138,32 @@
|
|
|
150
138
|
"default": "./base64Url.cjs"
|
|
151
139
|
}
|
|
152
140
|
},
|
|
141
|
+
"./capLength": {
|
|
142
|
+
"types": "./capLength.d.ts",
|
|
143
|
+
"import": {
|
|
144
|
+
"production": "./capLength.min.mjs",
|
|
145
|
+
"development": "./capLength.mjs",
|
|
146
|
+
"default": "./capLength.mjs"
|
|
147
|
+
},
|
|
148
|
+
"require": {
|
|
149
|
+
"production": "./capLength.min.cjs",
|
|
150
|
+
"development": "./capLength.cjs",
|
|
151
|
+
"default": "./capLength.cjs"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"./concatIterators": {
|
|
155
|
+
"types": "./concatIterators.d.ts",
|
|
156
|
+
"import": {
|
|
157
|
+
"production": "./concatIterators.min.mjs",
|
|
158
|
+
"development": "./concatIterators.mjs",
|
|
159
|
+
"default": "./concatIterators.mjs"
|
|
160
|
+
},
|
|
161
|
+
"require": {
|
|
162
|
+
"production": "./concatIterators.min.cjs",
|
|
163
|
+
"development": "./concatIterators.cjs",
|
|
164
|
+
"default": "./concatIterators.cjs"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
153
167
|
"./dateTimeStr": {
|
|
154
168
|
"types": "./dateTimeStr.d.ts",
|
|
155
169
|
"import": {
|
|
@@ -202,19 +216,6 @@
|
|
|
202
216
|
"default": "./isPromise.cjs"
|
|
203
217
|
}
|
|
204
218
|
},
|
|
205
|
-
"./iterators": {
|
|
206
|
-
"types": "./iterators.d.ts",
|
|
207
|
-
"import": {
|
|
208
|
-
"production": "./iterators.min.mjs",
|
|
209
|
-
"development": "./iterators.mjs",
|
|
210
|
-
"default": "./iterators.mjs"
|
|
211
|
-
},
|
|
212
|
-
"require": {
|
|
213
|
-
"production": "./iterators.min.cjs",
|
|
214
|
-
"development": "./iterators.cjs",
|
|
215
|
-
"default": "./iterators.cjs"
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
219
|
"./kvStore": {
|
|
219
220
|
"types": "./kvStore.d.ts",
|
|
220
221
|
"import": {
|
|
@@ -241,19 +242,6 @@
|
|
|
241
242
|
"default": "./localStore.cjs"
|
|
242
243
|
}
|
|
243
244
|
},
|
|
244
|
-
"./logging": {
|
|
245
|
-
"types": "./logging.d.ts",
|
|
246
|
-
"import": {
|
|
247
|
-
"production": "./logging.min.mjs",
|
|
248
|
-
"development": "./logging.mjs",
|
|
249
|
-
"default": "./logging.mjs"
|
|
250
|
-
},
|
|
251
|
-
"require": {
|
|
252
|
-
"production": "./logging.min.cjs",
|
|
253
|
-
"development": "./logging.cjs",
|
|
254
|
-
"default": "./logging.cjs"
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
245
|
"./mean": {
|
|
258
246
|
"types": "./mean.d.ts",
|
|
259
247
|
"import": {
|
|
@@ -319,6 +307,19 @@
|
|
|
319
307
|
"default": "./round.cjs"
|
|
320
308
|
}
|
|
321
309
|
},
|
|
310
|
+
"./roundToString": {
|
|
311
|
+
"types": "./roundToString.d.ts",
|
|
312
|
+
"import": {
|
|
313
|
+
"production": "./roundToString.min.mjs",
|
|
314
|
+
"development": "./roundToString.mjs",
|
|
315
|
+
"default": "./roundToString.mjs"
|
|
316
|
+
},
|
|
317
|
+
"require": {
|
|
318
|
+
"production": "./roundToString.min.cjs",
|
|
319
|
+
"development": "./roundToString.cjs",
|
|
320
|
+
"default": "./roundToString.cjs"
|
|
321
|
+
}
|
|
322
|
+
},
|
|
322
323
|
"./safeBtoa": {
|
|
323
324
|
"types": "./safeBtoa.d.ts",
|
|
324
325
|
"import": {
|
|
@@ -435,6 +436,19 @@
|
|
|
435
436
|
"development": "./timer.cjs",
|
|
436
437
|
"default": "./timer.cjs"
|
|
437
438
|
}
|
|
439
|
+
},
|
|
440
|
+
"./toReadableString": {
|
|
441
|
+
"types": "./toReadableString.d.ts",
|
|
442
|
+
"import": {
|
|
443
|
+
"production": "./toReadableString.min.mjs",
|
|
444
|
+
"development": "./toReadableString.mjs",
|
|
445
|
+
"default": "./toReadableString.mjs"
|
|
446
|
+
},
|
|
447
|
+
"require": {
|
|
448
|
+
"production": "./toReadableString.min.cjs",
|
|
449
|
+
"development": "./toReadableString.cjs",
|
|
450
|
+
"default": "./toReadableString.cjs"
|
|
451
|
+
}
|
|
438
452
|
}
|
|
439
453
|
},
|
|
440
454
|
"typesVersions": {
|
|
@@ -448,12 +462,15 @@
|
|
|
448
462
|
"assert": [
|
|
449
463
|
"./assert.d.ts"
|
|
450
464
|
],
|
|
451
|
-
"average": [
|
|
452
|
-
"./average.d.ts"
|
|
453
|
-
],
|
|
454
465
|
"base64Url": [
|
|
455
466
|
"./base64Url.d.ts"
|
|
456
467
|
],
|
|
468
|
+
"capLength": [
|
|
469
|
+
"./capLength.d.ts"
|
|
470
|
+
],
|
|
471
|
+
"concatIterators": [
|
|
472
|
+
"./concatIterators.d.ts"
|
|
473
|
+
],
|
|
457
474
|
"dateTimeStr": [
|
|
458
475
|
"./dateTimeStr.d.ts"
|
|
459
476
|
],
|
|
@@ -466,18 +483,12 @@
|
|
|
466
483
|
"isPromise": [
|
|
467
484
|
"./isPromise.d.ts"
|
|
468
485
|
],
|
|
469
|
-
"iterators": [
|
|
470
|
-
"./iterators.d.ts"
|
|
471
|
-
],
|
|
472
486
|
"kvStore": [
|
|
473
487
|
"./kvStore.d.ts"
|
|
474
488
|
],
|
|
475
489
|
"localStore": [
|
|
476
490
|
"./localStore.d.ts"
|
|
477
491
|
],
|
|
478
|
-
"logging": [
|
|
479
|
-
"./logging.d.ts"
|
|
480
|
-
],
|
|
481
492
|
"mean": [
|
|
482
493
|
"./mean.d.ts"
|
|
483
494
|
],
|
|
@@ -493,6 +504,9 @@
|
|
|
493
504
|
"round": [
|
|
494
505
|
"./round.d.ts"
|
|
495
506
|
],
|
|
507
|
+
"roundToString": [
|
|
508
|
+
"./roundToString.d.ts"
|
|
509
|
+
],
|
|
496
510
|
"safeBtoa": [
|
|
497
511
|
"./safeBtoa.d.ts"
|
|
498
512
|
],
|
|
@@ -519,6 +533,9 @@
|
|
|
519
533
|
],
|
|
520
534
|
"timer": [
|
|
521
535
|
"./timer.d.ts"
|
|
536
|
+
],
|
|
537
|
+
"toReadableString": [
|
|
538
|
+
"./toReadableString.d.ts"
|
|
522
539
|
]
|
|
523
540
|
}
|
|
524
541
|
}
|
package/round.cjs
CHANGED
|
@@ -20,22 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/round.ts
|
|
21
21
|
var round_exports = {};
|
|
22
22
|
__export(round_exports, {
|
|
23
|
-
round: () => round
|
|
24
|
-
roundS: () => roundS
|
|
23
|
+
round: () => round
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(round_exports);
|
|
27
26
|
function round(n, numDecimalPlaces = 0) {
|
|
28
27
|
const multipler = Math.pow(10, numDecimalPlaces);
|
|
29
28
|
return Math.round(n * multipler) / multipler;
|
|
30
29
|
}
|
|
31
|
-
function roundS(n, numDecimalPlaces = 0) {
|
|
32
|
-
return round(n, numDecimalPlaces).toLocaleString("en-US", {
|
|
33
|
-
minimumFractionDigits: numDecimalPlaces,
|
|
34
|
-
maximumFractionDigits: numDecimalPlaces
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
31
|
0 && (module.exports = {
|
|
39
|
-
round
|
|
40
|
-
roundS
|
|
32
|
+
round
|
|
41
33
|
});
|
package/round.d.mts
CHANGED
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
* Simplifies rounding of floating point numbers. Note that if your number ends
|
|
3
3
|
* with zeros, and you convert the number to string, you will lose the zeroes
|
|
4
4
|
* at the end. To show the exact number of decimal places, you'll need to use
|
|
5
|
-
* toFixed(). E.g. round(1.20, 2).toFixed(2).
|
|
5
|
+
* roundToString() or toFixed(). E.g. round(1.20, 2).toFixed(2).
|
|
6
6
|
*/
|
|
7
7
|
declare function round(n: number, numDecimalPlaces?: number): number;
|
|
8
|
-
/**
|
|
9
|
-
* Returns a string with the number in the exact number of decimal places
|
|
10
|
-
* specified, in case the number ends with zeroes, and adding commas for each
|
|
11
|
-
* group of 3 significant digits.
|
|
12
|
-
*/
|
|
13
|
-
declare function roundS(n: number, numDecimalPlaces?: number): string;
|
|
14
8
|
|
|
15
|
-
export { round
|
|
9
|
+
export { round };
|
package/round.d.ts
CHANGED
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
* Simplifies rounding of floating point numbers. Note that if your number ends
|
|
3
3
|
* with zeros, and you convert the number to string, you will lose the zeroes
|
|
4
4
|
* at the end. To show the exact number of decimal places, you'll need to use
|
|
5
|
-
* toFixed(). E.g. round(1.20, 2).toFixed(2).
|
|
5
|
+
* roundToString() or toFixed(). E.g. round(1.20, 2).toFixed(2).
|
|
6
6
|
*/
|
|
7
7
|
declare function round(n: number, numDecimalPlaces?: number): number;
|
|
8
|
-
/**
|
|
9
|
-
* Returns a string with the number in the exact number of decimal places
|
|
10
|
-
* specified, in case the number ends with zeroes, and adding commas for each
|
|
11
|
-
* group of 3 significant digits.
|
|
12
|
-
*/
|
|
13
|
-
declare function roundS(n: number, numDecimalPlaces?: number): string;
|
|
14
8
|
|
|
15
|
-
export { round
|
|
9
|
+
export { round };
|
package/round.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,n)=>{for(var t in n)o(r,t,{get:n[t],enumerable:!0})},c=(r,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of p(n))!a.call(r,u)&&u!==t&&o(r,u,{get:()=>n[u],enumerable:!(e=m(n,u))||e.enumerable});return r};var d=r=>c(o({},"__esModule",{value:!0}),r);var i={};b(i,{round:()=>h});module.exports=d(i);function h(r,n=0){let t=Math.pow(10,n);return Math.round(r*t)/t}0&&(module.exports={round});
|
|
2
2
|
//# sourceMappingURL=round.min.cjs.map
|
package/round.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/round.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n
|
|
1
|
+
{"version":3,"sources":["../src/round.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * roundToString() or toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GAMO,SAASE,EAAME,EAAWC,EAAmB,EAAW,CAC7D,IAAMC,EAAY,KAAK,IAAI,GAAID,CAAgB,EAC/C,OAAO,KAAK,MAAMD,EAAIE,CAAS,EAAIA,CACrC","names":["round_exports","__export","round","__toCommonJS","n","numDecimalPlaces","multipler"]}
|
package/round.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function u(r,t=0){let n=Math.pow(10,t);return Math.round(r*n)/n}export{u as round};
|
|
2
2
|
//# sourceMappingURL=round.min.mjs.map
|
package/round.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/round.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n
|
|
1
|
+
{"version":3,"sources":["../src/round.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * roundToString() or toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n"],"mappings":"AAMO,SAASA,EAAMC,EAAWC,EAAmB,EAAW,CAC7D,IAAMC,EAAY,KAAK,IAAI,GAAID,CAAgB,EAC/C,OAAO,KAAK,MAAMD,EAAIE,CAAS,EAAIA,CACrC","names":["round","n","numDecimalPlaces","multipler"]}
|
package/round.mjs
CHANGED
|
@@ -3,13 +3,6 @@ function round(n, numDecimalPlaces = 0) {
|
|
|
3
3
|
const multipler = Math.pow(10, numDecimalPlaces);
|
|
4
4
|
return Math.round(n * multipler) / multipler;
|
|
5
5
|
}
|
|
6
|
-
function roundS(n, numDecimalPlaces = 0) {
|
|
7
|
-
return round(n, numDecimalPlaces).toLocaleString("en-US", {
|
|
8
|
-
minimumFractionDigits: numDecimalPlaces,
|
|
9
|
-
maximumFractionDigits: numDecimalPlaces
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
6
|
export {
|
|
13
|
-
round
|
|
14
|
-
roundS
|
|
7
|
+
round
|
|
15
8
|
};
|
|
@@ -17,31 +17,27 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
24
|
-
stringify: () => stringify
|
|
20
|
+
// src/roundToString.ts
|
|
21
|
+
var roundToString_exports = {};
|
|
22
|
+
__export(roundToString_exports, {
|
|
23
|
+
roundToString: () => roundToString
|
|
25
24
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return u.toString();
|
|
33
|
-
}
|
|
34
|
-
return JSON.stringify(u);
|
|
25
|
+
module.exports = __toCommonJS(roundToString_exports);
|
|
26
|
+
|
|
27
|
+
// src/round.ts
|
|
28
|
+
function round(n, numDecimalPlaces = 0) {
|
|
29
|
+
const multipler = Math.pow(10, numDecimalPlaces);
|
|
30
|
+
return Math.round(n * multipler) / multipler;
|
|
35
31
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
|
|
33
|
+
// src/roundToString.ts
|
|
34
|
+
function roundToString(n, numDecimalPlaces = 0) {
|
|
35
|
+
return round(n, numDecimalPlaces).toLocaleString("en-US", {
|
|
36
|
+
minimumFractionDigits: numDecimalPlaces,
|
|
37
|
+
maximumFractionDigits: numDecimalPlaces
|
|
38
|
+
});
|
|
42
39
|
}
|
|
43
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
41
|
0 && (module.exports = {
|
|
45
|
-
|
|
46
|
-
stringify
|
|
42
|
+
roundToString
|
|
47
43
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a string with the number in the exact number of decimal places
|
|
3
|
+
* specified, in case the number ends with zeroes, and adding commas for each
|
|
4
|
+
* group of 3 significant digits.
|
|
5
|
+
*/
|
|
6
|
+
declare function roundToString(n: number, numDecimalPlaces?: number): string;
|
|
7
|
+
|
|
8
|
+
export { roundToString };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a string with the number in the exact number of decimal places
|
|
3
|
+
* specified, in case the number ends with zeroes, and adding commas for each
|
|
4
|
+
* group of 3 significant digits.
|
|
5
|
+
*/
|
|
6
|
+
declare function roundToString(n: number, numDecimalPlaces?: number): string;
|
|
7
|
+
|
|
8
|
+
export { roundToString };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(n,r)=>{for(var t in r)i(n,t,{get:r[t],enumerable:!0})},b=(n,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of g(r))!p.call(n,o)&&o!==t&&i(n,o,{get:()=>r[o],enumerable:!(u=e(r,o))||u.enumerable});return n};var f=n=>b(i({},"__esModule",{value:!0}),n);var S={};d(S,{roundToString:()=>x});module.exports=f(S);function m(n,r=0){let t=Math.pow(10,r);return Math.round(n*t)/t}function x(n,r=0){return m(n,r).toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}0&&(module.exports={roundToString});
|
|
2
|
+
//# sourceMappingURL=roundToString.min.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/roundToString.ts","../src/round.ts"],"sourcesContent":["import { round } from \"./round\";\n\n/**\n * Returns a string with the number in the exact number of decimal places\n * specified, in case the number ends with zeroes, and adding commas for each\n * group of 3 significant digits.\n */\nexport function roundToString(n: number, numDecimalPlaces = 0): string {\n return round(n, numDecimalPlaces).toLocaleString(\"en-US\", {\n minimumFractionDigits: numDecimalPlaces,\n maximumFractionDigits: numDecimalPlaces,\n });\n}\n","/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * roundToString() or toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GCMO,SAASI,EAAM,EAAWC,EAAmB,EAAW,CAC7D,IAAMC,EAAY,KAAK,IAAI,GAAID,CAAgB,EAC/C,OAAO,KAAK,MAAM,EAAIC,CAAS,EAAIA,CACrC,CDFO,SAASC,EAAc,EAAWC,EAAmB,EAAW,CACrE,OAAOC,EAAM,EAAGD,CAAgB,EAAE,eAAe,QAAS,CACxD,sBAAuBA,EACvB,sBAAuBA,CACzB,CAAC,CACH","names":["roundToString_exports","__export","roundToString","__toCommonJS","round","numDecimalPlaces","multipler","roundToString","numDecimalPlaces","round"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/round.ts","../src/roundToString.ts"],"sourcesContent":["/**\n * Simplifies rounding of floating point numbers. Note that if your number ends\n * with zeros, and you convert the number to string, you will lose the zeroes\n * at the end. To show the exact number of decimal places, you'll need to use\n * roundToString() or toFixed(). E.g. round(1.20, 2).toFixed(2).\n */\nexport function round(n: number, numDecimalPlaces = 0): number {\n const multipler = Math.pow(10, numDecimalPlaces);\n return Math.round(n * multipler) / multipler;\n}\n","import { round } from \"./round\";\n\n/**\n * Returns a string with the number in the exact number of decimal places\n * specified, in case the number ends with zeroes, and adding commas for each\n * group of 3 significant digits.\n */\nexport function roundToString(n: number, numDecimalPlaces = 0): string {\n return round(n, numDecimalPlaces).toLocaleString(\"en-US\", {\n minimumFractionDigits: numDecimalPlaces,\n maximumFractionDigits: numDecimalPlaces,\n });\n}\n"],"mappings":"AAMO,SAASA,EAAM,EAAWC,EAAmB,EAAW,CAC7D,IAAMC,EAAY,KAAK,IAAI,GAAID,CAAgB,EAC/C,OAAO,KAAK,MAAM,EAAIC,CAAS,EAAIA,CACrC,CCFO,SAASC,EAAc,EAAWC,EAAmB,EAAW,CACrE,OAAOC,EAAM,EAAGD,CAAgB,EAAE,eAAe,QAAS,CACxD,sBAAuBA,EACvB,sBAAuBA,CACzB,CAAC,CACH","names":["round","numDecimalPlaces","multipler","roundToString","numDecimalPlaces","round"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/round.ts
|
|
2
|
+
function round(n, numDecimalPlaces = 0) {
|
|
3
|
+
const multipler = Math.pow(10, numDecimalPlaces);
|
|
4
|
+
return Math.round(n * multipler) / multipler;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// src/roundToString.ts
|
|
8
|
+
function roundToString(n, numDecimalPlaces = 0) {
|
|
9
|
+
return round(n, numDecimalPlaces).toLocaleString("en-US", {
|
|
10
|
+
minimumFractionDigits: numDecimalPlaces,
|
|
11
|
+
maximumFractionDigits: numDecimalPlaces
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
roundToString
|
|
16
|
+
};
|
package/sum.cjs
CHANGED
|
@@ -26,13 +26,13 @@ module.exports = __toCommonJS(sum_exports);
|
|
|
26
26
|
|
|
27
27
|
// src/asNumber.ts
|
|
28
28
|
function asNumber(u) {
|
|
29
|
+
if (typeof u === "number") {
|
|
30
|
+
return isFinite(u) ? u : 0;
|
|
31
|
+
}
|
|
32
|
+
u = Number(u);
|
|
29
33
|
if (typeof u === "number" && isFinite(u)) {
|
|
30
34
|
return u;
|
|
31
35
|
}
|
|
32
|
-
const n = Number(u);
|
|
33
|
-
if (typeof n === "number" && isFinite(n)) {
|
|
34
|
-
return n;
|
|
35
|
-
}
|
|
36
36
|
return 0;
|
|
37
37
|
}
|
|
38
38
|
|
package/sum.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var e in r)u(n,e,{get:r[e],enumerable:!0})},s=(n,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of b(r))!f.call(n,t)&&t!==e&&u(n,t,{get:()=>r[t],enumerable:!(i=o(r,t))||i.enumerable});return n};var c=n=>s(u({},"__esModule",{value:!0}),n);var w={};p(w,{sum:()=>k});module.exports=c(w);function m(n){return typeof n=="number"?isFinite(n)?n:0:(n=Number(n),typeof n=="number"&&isFinite(n)?n:0)}function k(n){return n.reduce((r,e)=>r+m(e),0)}0&&(module.exports={sum});
|
|
2
2
|
//# sourceMappingURL=sum.min.cjs.map
|
package/sum.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sum.ts","../src/asNumber.ts"],"sourcesContent":["import { asNumber } from \"./asNumber\";\n\n/**\n * Add all the numbers together in the given array.\n * Non-numbers will be coerced into numbers if possible.\n */\nexport function sum(numbers: unknown[]): number {\n return numbers.reduce((accumulated: number, current: unknown) => {\n return accumulated + asNumber(current);\n }, 0);\n}\n","/**\n * Coerce `u` into a number if possible, otherwise just return 0.\n */\nexport function asNumber(u: unknown): number {\n //
|
|
1
|
+
{"version":3,"sources":["../src/sum.ts","../src/asNumber.ts"],"sourcesContent":["import { asNumber } from \"./asNumber\";\n\n/**\n * Add all the numbers together in the given array.\n * Non-numbers will be coerced into numbers if possible.\n */\nexport function sum(numbers: unknown[]): number {\n return numbers.reduce((accumulated: number, current: unknown) => {\n return accumulated + asNumber(current);\n }, 0);\n}\n","/**\n * Coerce `u` into a number if possible, otherwise just return 0.\n */\nexport function asNumber(u: unknown): number {\n // If u is a valid number, return it.\n if (typeof u === \"number\") {\n return isFinite(u) ? u : 0;\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 0 for everything else. This is usually ok if want to just ignore\n // all other noise.\n return 0;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,SAAAE,IAAA,eAAAC,EAAAH,GCGO,SAASI,EAASC,EAAoB,CAE3C,OAAI,OAAOA,GAAM,SACR,SAASA,CAAC,EAAIA,EAAI,GAI3BA,EAAI,OAAOA,CAAC,EAGR,OAAOA,GAAM,UAAY,SAASA,CAAC,EAC9BA,EAKF,EACT,CDdO,SAASC,EAAIC,EAA4B,CAC9C,OAAOA,EAAQ,OAAO,CAACC,EAAqBC,IACnCD,EAAcE,EAASD,CAAO,EACpC,CAAC,CACN","names":["sum_exports","__export","sum","__toCommonJS","asNumber","u","sum","numbers","accumulated","current","asNumber"]}
|
package/sum.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(n){return typeof n=="number"?isFinite(n)?n:0:(n=Number(n),typeof n=="number"&&isFinite(n)?n:0)}function m(n){return n.reduce((e,t)=>e+r(t),0)}export{m as sum};
|
|
2
2
|
//# sourceMappingURL=sum.min.mjs.map
|
package/sum.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asNumber.ts","../src/sum.ts"],"sourcesContent":["/**\n * Coerce `u` into a number if possible, otherwise just return 0.\n */\nexport function asNumber(u: unknown): number {\n //
|
|
1
|
+
{"version":3,"sources":["../src/asNumber.ts","../src/sum.ts"],"sourcesContent":["/**\n * Coerce `u` into a number if possible, otherwise just return 0.\n */\nexport function asNumber(u: unknown): number {\n // If u is a valid number, return it.\n if (typeof u === \"number\") {\n return isFinite(u) ? u : 0;\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 0 for everything else. This is usually ok if want to just ignore\n // all other noise.\n return 0;\n}\n","import { asNumber } from \"./asNumber\";\n\n/**\n * Add all the numbers together in the given array.\n * Non-numbers will be coerced into numbers if possible.\n */\nexport function sum(numbers: unknown[]): number {\n return numbers.reduce((accumulated: number, current: unknown) => {\n return accumulated + asNumber(current);\n }, 0);\n}\n"],"mappings":"AAGO,SAASA,EAASC,EAAoB,CAE3C,OAAI,OAAOA,GAAM,SACR,SAASA,CAAC,EAAIA,EAAI,GAI3BA,EAAI,OAAOA,CAAC,EAGR,OAAOA,GAAM,UAAY,SAASA,CAAC,EAC9BA,EAKF,EACT,CCdO,SAASC,EAAIC,EAA4B,CAC9C,OAAOA,EAAQ,OAAO,CAACC,EAAqBC,IACnCD,EAAcE,EAASD,CAAO,EACpC,CAAC,CACN","names":["asNumber","u","sum","numbers","accumulated","current","asNumber"]}
|
package/sum.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// src/asNumber.ts
|
|
2
2
|
function asNumber(u) {
|
|
3
|
+
if (typeof u === "number") {
|
|
4
|
+
return isFinite(u) ? u : 0;
|
|
5
|
+
}
|
|
6
|
+
u = Number(u);
|
|
3
7
|
if (typeof u === "number" && isFinite(u)) {
|
|
4
8
|
return u;
|
|
5
9
|
}
|
|
6
|
-
const n = Number(u);
|
|
7
|
-
if (typeof n === "number" && isFinite(n)) {
|
|
8
|
-
return n;
|
|
9
|
-
}
|
|
10
10
|
return 0;
|
|
11
11
|
}
|
|
12
12
|
|
package/timer.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var D=(t,r)=>{for(var o in r)c(t,o,{get:r[o],enumerable:!0})},M=(t,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of m(r))!h.call(t,n)&&n!==o&&c(t,n,{get:()=>r[n],enumerable:!(i=d(r,n))||i.enumerable});return t};var g=t=>M(c({},"__esModule",{value:!0}),t);var A={};D(A,{Timer:()=>l,timer:()=>O});module.exports=g(A);var _=["days","hours","minutes","seconds","milliseconds"],T={days:{short:"day",shorts:"days",long:"day",longs:"days",narrow:"d"},hours:{short:"hr",shorts:"hrs",long:"hour",longs:"hours",narrow:"h"},minutes:{short:"min",shorts:"mins",long:"minute",longs:"minutes",narrow:"m"},seconds:{short:"sec",shorts:"secs",long:"second",longs:"seconds",narrow:"s"},milliseconds:{short:"ms",shorts:"ms",long:"millisecond",longs:"milliseconds",narrow:"ms"}};function E(t){return t=="short"?"shorts":t==="long"?"longs":t}function w(t){return t==="narrow"?"":" "}function R(t){return t==="narrow"?" ":", "}function P(t,r){if(t===0)return r=r??"milliseconds",{[r]:0};let o={};for(let i=0;i<1;i++){let n=Math.floor(t/1e3),a=t-n*1e3;if(a>0&&(o.milliseconds=a),n===0)break;let e=Math.floor(n/60);if(n-=e*60,n>0&&(o.seconds=n),e===0)break;let s=Math.floor(e/60);if(e-=s*60,e>0&&(o.minutes=e),s===0)break;let u=Math.floor(s/24);s-=u*24,s>0&&(o.hours=s),u>0&&(o.days=u)}return o}function U(t,r){r=r??"short";let o=E(r),i=w(r),n=[];for(let e of _){let s=t[e];if(s===void 0)continue;let u=T[e],f=s===1?u[r]:u[o];n.push(s+i+f)}let a=R(r);return n.join(a)}function N(t,r){let o=P(t,r?.durationTypeForZero);return U(o,r?.style)}function p(t){return t>6e4?N(t):t>100?`${(t/1e3).toFixed(3)}s`:t+"ms"}var l=class{startMs;endMs=0;constructor(){this.startMs=Date.now()}stop(){this.endMs=Date.now()}restart(){this.endMs=0,this.startMs=Date.now()}elapsedMs(){return(this.endMs||Date.now())-this.startMs}toString(){return p(this.elapsedMs())}};function O(){return new l}0&&(module.exports={Timer,timer});
|
|
2
2
|
//# sourceMappingURL=timer.min.cjs.map
|
package/timer.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var D=["days","hours","minutes","seconds","milliseconds"],M={days:{short:"day",shorts:"days",long:"day",longs:"days",narrow:"d"},hours:{short:"hr",shorts:"hrs",long:"hour",longs:"hours",narrow:"h"},minutes:{short:"min",shorts:"mins",long:"minute",longs:"minutes",narrow:"m"},seconds:{short:"sec",shorts:"secs",long:"second",longs:"seconds",narrow:"s"},milliseconds:{short:"ms",shorts:"ms",long:"millisecond",longs:"milliseconds",narrow:"ms"}};function g(t){return t=="short"?"shorts":t==="long"?"longs":t}function y(t){return t==="narrow"?"":" "}function S(t){return t==="narrow"?" ":", "}function b(t,r){if(t===0)return r=r??"milliseconds",{[r]:0};let o={};for(let u=0;u<1;u++){let s=Math.floor(t/1e3),a=t-s*1e3;if(a>0&&(o.milliseconds=a),s===0)break;let e=Math.floor(s/60);if(s-=e*60,s>0&&(o.seconds=s),e===0)break;let n=Math.floor(e/60);if(e-=n*60,e>0&&(o.minutes=e),n===0)break;let i=Math.floor(n/24);n-=i*24,n>0&&(o.hours=n),i>0&&(o.days=i)}return o}function x(t,r){r=r??"short";let o=g(r),u=y(r),s=[];for(let e of D){let n=t[e];if(n===void 0)continue;let i=M[e],p=n===1?i[r]:i[o];s.push(n+u+p)}let a=S(r);return s.join(a)}function _(t,r){let o=b(t,r?.durationTypeForZero);return x(o,r?.style)}function c(t){return t>6e4?_(t):t>100?`${(t/1e3).toFixed(3)}s`:t+"ms"}var l=class{startMs;endMs=0;constructor(){this.startMs=Date.now()}stop(){this.endMs=Date.now()}restart(){this.endMs=0,this.startMs=Date.now()}elapsedMs(){return(this.endMs||Date.now())-this.startMs}toString(){return c(this.elapsedMs())}};function R(){return new l}export{l as Timer,R as timer};
|
|
2
2
|
//# sourceMappingURL=timer.min.mjs.map
|
|
@@ -0,0 +1,69 @@
|
|
|
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/toReadableString.ts
|
|
21
|
+
var toReadableString_exports = {};
|
|
22
|
+
__export(toReadableString_exports, {
|
|
23
|
+
toReadableString: () => toReadableString
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(toReadableString_exports);
|
|
26
|
+
function toReadableString(u, options) {
|
|
27
|
+
if (typeof u === "string") {
|
|
28
|
+
return u;
|
|
29
|
+
}
|
|
30
|
+
if (u instanceof Error) {
|
|
31
|
+
const error = u;
|
|
32
|
+
let result = "";
|
|
33
|
+
const errorName = error.name || "Error";
|
|
34
|
+
const errorMessage = error.message || "An error occurred with no message provided.";
|
|
35
|
+
result += `${errorName}: ${errorMessage}`;
|
|
36
|
+
if (options?.includeStack && error.stack) {
|
|
37
|
+
const stack = error.stack.replace(new RegExp(`^${errorName}:.*\\n?`), "").trim();
|
|
38
|
+
if (stack) {
|
|
39
|
+
result += `
|
|
40
|
+
Stack Trace:
|
|
41
|
+
${stack}`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (options?.includeErrorProps) {
|
|
45
|
+
const customProps = error;
|
|
46
|
+
const additionalInfo = Object.keys(customProps).filter(
|
|
47
|
+
(key) => key !== "name" && key !== "message" && key !== "stack" && typeof customProps[key] !== "function" && typeof customProps[key] !== "object"
|
|
48
|
+
).map((key) => `
|
|
49
|
+
- ${key}: ${customProps[key]}`);
|
|
50
|
+
if (additionalInfo.length > 0) {
|
|
51
|
+
result += `
|
|
52
|
+
Additional Data:${additionalInfo.join("")}`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
if (u !== null && typeof u === "object" && u.toString !== Object.prototype.toString) {
|
|
58
|
+
return u.toString();
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return JSON.stringify(u);
|
|
62
|
+
} catch {
|
|
63
|
+
return String(u);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
toReadableString
|
|
69
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make the given argument of unknown type into something human-readable.
|
|
3
|
+
* For Error objects, you can specify options to make the string more verbose.
|
|
4
|
+
*/
|
|
5
|
+
declare function toReadableString(u: unknown, options?: {
|
|
6
|
+
includeStack?: boolean;
|
|
7
|
+
includeErrorProps?: boolean;
|
|
8
|
+
}): string;
|
|
9
|
+
|
|
10
|
+
export { toReadableString };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make the given argument of unknown type into something human-readable.
|
|
3
|
+
* For Error objects, you can specify options to make the string more verbose.
|
|
4
|
+
*/
|
|
5
|
+
declare function toReadableString(u: unknown, options?: {
|
|
6
|
+
includeStack?: boolean;
|
|
7
|
+
includeErrorProps?: boolean;
|
|
8
|
+
}): string;
|
|
9
|
+
|
|
10
|
+
export { toReadableString };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(r,t)=>{for(var n in t)c(r,n,{get:t[n],enumerable:!0})},m=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of g(t))!p.call(r,e)&&e!==n&&c(r,e,{get:()=>t[e],enumerable:!(i=l(t,e))||i.enumerable});return r};var S=r=>m(c({},"__esModule",{value:!0}),r);var b={};d(b,{toReadableString:()=>u});module.exports=S(b);function u(r,t){if(typeof r=="string")return r;if(r instanceof Error){let n=r,i="",e=n.name||"Error",f=n.message||"An error occurred with no message provided.";if(i+=`${e}: ${f}`,t?.includeStack&&n.stack){let a=n.stack.replace(new RegExp(`^${e}:.*\\n?`),"").trim();a&&(i+=`
|
|
2
|
+
Stack Trace:
|
|
3
|
+
${a}`)}if(t?.includeErrorProps){let a=n,s=Object.keys(a).filter(o=>o!=="name"&&o!=="message"&&o!=="stack"&&typeof a[o]!="function"&&typeof a[o]!="object").map(o=>`
|
|
4
|
+
- ${o}: ${a[o]}`);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)}}0&&(module.exports={toReadableString});
|
|
6
|
+
//# sourceMappingURL=toReadableString.min.cjs.map
|