@qrvey/utils 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +524 -524
- package/dist/cjs/format/format.js +2 -2
- package/dist/format/format.js +2 -2
- package/package.json +1 -1
- package/src/format/format.ts +2 -2
- package/test/format.test.js +1 -1
|
@@ -35,8 +35,8 @@ function formatAbbreviated(num, decimals) {
|
|
|
35
35
|
const absValue = Math.abs(num);
|
|
36
36
|
const exp = Math.floor(Math.log10(absValue));
|
|
37
37
|
if (exp < 0 && exp >= -3)
|
|
38
|
-
return
|
|
39
|
-
return (0, d3_1.format)(num > -100 && num < 100 ? '' : '.3s')(num);
|
|
38
|
+
return num.toFixed(decimals === 0 ? 2 : decimals);
|
|
39
|
+
return (0, d3_1.format)(num > -100 && num < 100 ? '.' + (decimals + 2) + 'n' : '.3s')(num);
|
|
40
40
|
}
|
|
41
41
|
exports.formatAbbreviated = formatAbbreviated;
|
|
42
42
|
function formatNumber(num, outputFormat, _config) {
|
package/dist/format/format.js
CHANGED
|
@@ -28,8 +28,8 @@ export function formatAbbreviated(num, decimals) {
|
|
|
28
28
|
const absValue = Math.abs(num);
|
|
29
29
|
const exp = Math.floor(Math.log10(absValue));
|
|
30
30
|
if (exp < 0 && exp >= -3)
|
|
31
|
-
return
|
|
32
|
-
return d3Format(num > -100 && num < 100 ? '' : '.3s')(num);
|
|
31
|
+
return num.toFixed(decimals === 0 ? 2 : decimals);
|
|
32
|
+
return d3Format(num > -100 && num < 100 ? '.' + (decimals + 2) + 'n' : '.3s')(num);
|
|
33
33
|
}
|
|
34
34
|
function formatNumber(num, outputFormat, _config) {
|
|
35
35
|
try {
|
package/package.json
CHANGED
package/src/format/format.ts
CHANGED
|
@@ -31,9 +31,9 @@ export function formatAbbreviated(num, decimals) {
|
|
|
31
31
|
const exp = Math.floor(Math.log10(absValue));
|
|
32
32
|
|
|
33
33
|
if (exp < 0 && exp >= -3)
|
|
34
|
-
return
|
|
34
|
+
return num.toFixed(decimals === 0 ? 2 : decimals);
|
|
35
35
|
|
|
36
|
-
return d3Format(num > -100 && num < 100 ? '' : '.3s')(num);
|
|
36
|
+
return d3Format(num > -100 && num < 100 ? '.' + (decimals + 2) + 'n' : '.3s')(num);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function formatNumber(num, outputFormat, _config?) {
|
package/test/format.test.js
CHANGED