Skip to content

Commit

Permalink
Optimizing the negative number flip using the simplest method (minus …
Browse files Browse the repository at this point in the history
…operator)
  • Loading branch information
avoidwork committed Feb 5, 2013
1 parent 1e538f6 commit 0fb401c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/filesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license BSD-3 <https://raw.github.com/avoidwork/filesize.js/master/LICENSE>
* @link http://filesizejs.com
* @module filesize
* @version 1.7.5
* @version 1.7.6
*/

(function (global) {
Expand Down Expand Up @@ -45,7 +45,7 @@
zero = /^0$/;

// Flipping a negative number to determine the size
if (neg) num = Math.abs(num);
if (neg) num = -num;

while (i--) {
size = sizes[i][1];
Expand Down
4 changes: 2 additions & 2 deletions lib/filesize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "1.7.5",
"version": "1.7.6",
"homepage": "http://filesizejs.com",
"author": {
"name": "Jason Mulligan",
Expand Down
2 changes: 1 addition & 1 deletion src/filesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
zero = /^0$/;

// Flipping a negative number to determine the size
if (neg) num = Math.abs(num);
if (neg) num = -num;

while (i--) {
size = sizes[i][1];
Expand Down

0 comments on commit 0fb401c

Please sign in to comment.