Skip to content

Commit 0fc96b8

Browse files
committed
Fixing the output when supplying 'precision'
1 parent 5deff97 commit 0fc96b8

File tree

10 files changed

+147
-4
lines changed

10 files changed

+147
-4
lines changed

dist/filesize.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const EXPONENT = "exponent";
3535
const ROUND = "round";
3636

3737
// Special Characters and Values
38+
const E = "e";
3839
const EMPTY = "";
3940
const PERIOD = ".";
4041
const S = "s";
@@ -198,6 +199,7 @@ function filesize (arg, {
198199
// Setting optional precision
199200
if (precision > 0) {
200201
result[0] = result[0].toPrecision(precision);
202+
result[0] = result[0].split(E)[0];
201203
}
202204

203205
// Applying custom symbol

dist/filesize.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const EXPONENT = "exponent";
3333
const ROUND = "round";
3434

3535
// Special Characters and Values
36+
const E = "e";
3637
const EMPTY = "";
3738
const PERIOD = ".";
3839
const S = "s";
@@ -194,6 +195,7 @@ function filesize (arg, {
194195
// Setting optional precision
195196
if (precision > 0) {
196197
result[0] = result[0].toPrecision(precision);
198+
result[0] = result[0].split(E)[0];
197199
}
198200

199201
// Applying custom symbol

dist/filesize.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/filesize.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/filesize.umd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const EXPONENT = "exponent";
3333
const ROUND = "round";
3434

3535
// Special Characters and Values
36+
const E = "e";
3637
const EMPTY = "";
3738
const PERIOD = ".";
3839
const S = "s";
@@ -194,6 +195,7 @@ function filesize (arg, {
194195
// Setting optional precision
195196
if (precision > 0) {
196197
result[0] = result[0].toPrecision(precision);
198+
result[0] = result[0].split(E)[0];
197199
}
198200

199201
// Applying custom symbol

dist/filesize.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)