Fix humand readable byte to number javascript method call

This commit is contained in:
Clemens Schwaighofer
2021-05-20 20:43:52 +09:00
parent 70a30c3182
commit ee6e0581da

View File

@@ -458,13 +458,13 @@ function formatBytesLong(bytes)
/** /**
* Convert a string with B/K/M/etc into a byte number * Convert a string with B/K/M/etc into a byte number
* @param {String} bytes Any string with B/K/M/etc * @param {String|Number} bytes Any string with B/K/M/etc
* @return {Number} A byte number, or original string as is * @return {String|Number} A byte number, or original string as is
*/ */
function stringByteFormat(bytes) function stringByteFormat(bytes)
{ {
// early abort if this is a number already // if anything not string return
if (!isNaN(bytes)) { if (!(typeof bytes === 'string' || bytes instanceof String)) {
return bytes; return bytes;
} }
// for pow exponent list // for pow exponent list