Skip to content

Commit 3b71615

Browse files
committed
Fixing order of ops that could've impacted object output
1 parent 26d4972 commit 3b71615

9 files changed

+23
-23
lines changed

lib/filesize.es6.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @copyright 2019 Jason Mulligan <[email protected]>
55
* @license BSD-3-Clause
6-
* @version 4.1.0
6+
* @version 4.1.1
77
*/
88
(function (global) {
99
const b = /^(b|B)$/,
@@ -121,10 +121,6 @@
121121
return e;
122122
}
123123

124-
if (output === "object") {
125-
return {value: result[0], symbol: result[1]};
126-
}
127-
128124
if (full) {
129125
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
130126
}
@@ -135,6 +131,10 @@
135131
result[0] = result[0].toString().replace(".", separator);
136132
}
137133

134+
if (output === "object") {
135+
return {value: result[0], symbol: result[1]};
136+
}
137+
138138
return result.join(spacer);
139139
}
140140

lib/filesize.es6.min.js

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

lib/filesize.es6.min.js.map

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

lib/filesize.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* @copyright 2019 Jason Mulligan <[email protected]>
77
* @license BSD-3-Clause
8-
* @version 4.1.0
8+
* @version 4.1.1
99
*/
1010
(function (global) {
1111
var b = /^(b|B)$/,
@@ -140,10 +140,6 @@
140140
return e;
141141
}
142142

143-
if (output === "object") {
144-
return { value: result[0], symbol: result[1] };
145-
}
146-
147143
if (full) {
148144
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
149145
}
@@ -154,6 +150,10 @@
154150
result[0] = result[0].toString().replace(".", separator);
155151
}
156152

153+
if (output === "object") {
154+
return { value: result[0], symbol: result[1] };
155+
}
156+
157157
return result.join(spacer);
158158
}
159159

lib/filesize.min.js

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

lib/filesize.min.js.map

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

package-lock.json

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "filesize",
33
"description": "JavaScript library to generate a human readable String describing the file size",
4-
"version": "4.1.0",
4+
"version": "4.1.1",
55
"homepage": "https://filesizejs.com",
66
"author": "Jason Mulligan <[email protected]>",
77
"repository": {

src/filesize.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@
9797
return e;
9898
}
9999

100-
if (output === "object") {
101-
return {value: result[0], symbol: result[1]};
102-
}
103-
104100
if (full) {
105101
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
106102
}
@@ -111,6 +107,10 @@
111107
result[0] = result[0].toString().replace(".", separator);
112108
}
113109

110+
if (output === "object") {
111+
return {value: result[0], symbol: result[1]};
112+
}
113+
114114
return result.join(spacer);
115115
}
116116

0 commit comments

Comments
 (0)