Skip to content

Commit b9f7fb4

Browse files
build
1 parent 63a453f commit b9f7fb4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/filesize.es6.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
function filesize (arg, descriptor = {}) {
3434
let result = [],
3535
val = 0,
36-
e, base, bits, ceil, full, fullforms, locale, neg, num, output, round, unix, separator, spacer, standard, symbols;
36+
e, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, round, unix, separator, spacer, standard, symbols;
3737

3838
if (isNaN(arg)) {
3939
throw new TypeError("Invalid number");
@@ -44,6 +44,7 @@
4444
base = descriptor.base || 2;
4545
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
4646
locale = descriptor.locale !== void 0 ? descriptor.locale : "";
47+
localeOptions = descriptor.localeOptions || {};
4748
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
4849
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
4950
symbols = descriptor.symbols || {};
@@ -119,7 +120,7 @@
119120
if (locale === true) {
120121
result[0] = result[0].toLocaleString();
121122
} else if (locale.length > 0) {
122-
result[0] = result[0].toLocaleString(locale);
123+
result[0] = result[0].toLocaleString(locale, localeOptions);
123124
} else if (separator.length > 0) {
124125
result[0] = result[0].toString().replace(".", separator);
125126
}

lib/filesize.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
full = void 0,
4545
fullforms = void 0,
4646
locale = void 0,
47+
localeOptions = void 0,
4748
neg = void 0,
4849
num = void 0,
4950
output = void 0,
@@ -63,6 +64,7 @@
6364
base = descriptor.base || 2;
6465
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
6566
locale = descriptor.locale !== void 0 ? descriptor.locale : "";
67+
localeOptions = descriptor.localeOptions || {};
6668
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
6769
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
6870
symbols = descriptor.symbols || {};
@@ -138,7 +140,7 @@
138140
if (locale === true) {
139141
result[0] = result[0].toLocaleString();
140142
} else if (locale.length > 0) {
141-
result[0] = result[0].toLocaleString(locale);
143+
result[0] = result[0].toLocaleString(locale, localeOptions);
142144
} else if (separator.length > 0) {
143145
result[0] = result[0].toString().replace(".", separator);
144146
}

0 commit comments

Comments
 (0)