+14
-12
@@ -6,3 +6,3 @@ /** | ||
| * @license BSD-3-Clause | ||
| * @version 4.1.1 | ||
| * @version 4.1.2 | ||
| */ | ||
@@ -40,3 +40,3 @@ (function (global) { | ||
| if (isNaN(arg)) { | ||
| throw new Error("Invalid arguments"); | ||
| throw new TypeError("Invalid number"); | ||
| } | ||
@@ -80,2 +80,6 @@ | ||
| if (output === "exponent") { | ||
| return e; | ||
| } | ||
| // Zero is now a special case because bytes divide by 1 | ||
@@ -118,2 +122,10 @@ if (num === 0) { | ||
| if (locale === true) { | ||
| result[0] = result[0].toLocaleString(); | ||
| } else if (locale.length > 0) { | ||
| result[0] = result[0].toLocaleString(locale); | ||
| } else if (separator.length > 0) { | ||
| result[0] = result[0].toString().replace(".", separator); | ||
| } | ||
| // Returning Array, Object, or String (default) | ||
@@ -124,6 +136,2 @@ if (output === "array") { | ||
| if (output === "exponent") { | ||
| return e; | ||
| } | ||
| if (full) { | ||
@@ -133,8 +141,2 @@ result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s"); | ||
| if (locale.length > 0) { | ||
| result[0] = result[0].toLocaleString(locale); | ||
| } else if (separator.length > 0) { | ||
| result[0] = result[0].toString().replace(".", separator); | ||
| } | ||
| if (output === "object") { | ||
@@ -141,0 +143,0 @@ return {value: result[0], symbol: result[1]}; |
+14
-12
@@ -8,3 +8,3 @@ "use strict"; | ||
| * @license BSD-3-Clause | ||
| * @version 4.1.1 | ||
| * @version 4.1.2 | ||
| */ | ||
@@ -59,3 +59,3 @@ (function (global) { | ||
| if (isNaN(arg)) { | ||
| throw new Error("Invalid arguments"); | ||
| throw new TypeError("Invalid number"); | ||
| } | ||
@@ -99,2 +99,6 @@ | ||
| if (output === "exponent") { | ||
| return e; | ||
| } | ||
| // Zero is now a special case because bytes divide by 1 | ||
@@ -137,2 +141,10 @@ if (num === 0) { | ||
| if (locale === true) { | ||
| result[0] = result[0].toLocaleString(); | ||
| } else if (locale.length > 0) { | ||
| result[0] = result[0].toLocaleString(locale); | ||
| } else if (separator.length > 0) { | ||
| result[0] = result[0].toString().replace(".", separator); | ||
| } | ||
| // Returning Array, Object, or String (default) | ||
@@ -143,6 +155,2 @@ if (output === "array") { | ||
| if (output === "exponent") { | ||
| return e; | ||
| } | ||
| if (full) { | ||
@@ -152,8 +160,2 @@ result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s"); | ||
| if (locale.length > 0) { | ||
| result[0] = result[0].toLocaleString(locale); | ||
| } else if (separator.length > 0) { | ||
| result[0] = result[0].toString().replace(".", separator); | ||
| } | ||
| if (output === "object") { | ||
@@ -160,0 +162,0 @@ return { value: result[0], symbol: result[1] }; |
+1
-1
| { | ||
| "name": "filesize", | ||
| "description": "JavaScript library to generate a human readable String describing the file size", | ||
| "version": "4.1.1", | ||
| "version": "4.1.2", | ||
| "homepage": "https://filesizejs.com", | ||
@@ -6,0 +6,0 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>", |
+1
-1
@@ -27,3 +27,3 @@ # filesize.js | ||
| ### locale (overrides 'separator') | ||
| _*(string)*_ BCP 47 language tag, default is `""` | ||
| _*(string || boolean)*_ BCP 47 language tag to specify a locale, or `true` to use default locale, default is `""` | ||
@@ -30,0 +30,0 @@ ### output |
15292
1.45%285
1.42%