Skip to content

Commit 65baab6

Browse files
committed
Updating CHANGELOG.md
1 parent 7570885 commit 65baab6

11 files changed

+70
-70
lines changed

lib/filesize.es6.js

+17-18
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,21 @@
1212
})(this, (function () { 'use strict';
1313

1414
const strings = {
15-
symbol: {
16-
iec: {
17-
bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"],
18-
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
19-
},
20-
jedec: {
21-
bits: ["bit", "Kbit", "Mbit", "Gbit", "Tbit", "Pbit", "Ebit", "Zbit", "Ybit"],
22-
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
23-
}
15+
symbol: {
16+
iec: {
17+
bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"],
18+
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
2419
},
25-
fullform: {
26-
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
27-
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
20+
jedec: {
21+
bits: ["bit", "Kbit", "Mbit", "Gbit", "Tbit", "Pbit", "Ebit", "Zbit", "Ybit"],
22+
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
2823
}
2924
},
30-
roundingFuncs = {
31-
ceil: Math.ceil,
32-
floor: Math.floor,
33-
round: Math.round
34-
};
25+
fullform: {
26+
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
27+
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
28+
}
29+
};
3530

3631
/**
3732
* filesize
@@ -54,12 +49,16 @@
5449
const ceil = base === 10 ? 1000 : 1024,
5550
full = fullform === true,
5651
neg = num < 0,
57-
roundingFunc = roundingFuncs[roundingMethod];
52+
roundingFunc = Math[roundingMethod];
5853

5954
if (isNaN(arg)) {
6055
throw new TypeError("Invalid number");
6156
}
6257

58+
if (typeof roundingFunc !== "function") {
59+
throw new TypeError("Invalid rounding method");
60+
}
61+
6362
// Flipping a negative number to determine the size
6463
if (neg) {
6564
num = -num;

lib/filesize.es6.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)