Skip to content

Commit

Permalink
Merge pull request #53 from avoidwork/edge
Browse files Browse the repository at this point in the history
Minor change
  • Loading branch information
avoidwork committed Mar 1, 2014
2 parents e41e93b + fd448ab commit a8966f8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
12 changes: 9 additions & 3 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 2.0.2
* @version 2.0.3
*/
( function ( global ) {
"use strict";
Expand Down Expand Up @@ -62,6 +62,12 @@ function filesize ( arg, descriptor ) {
else {
e = Math.floor( Math.log( num ) / Math.log( 1000 ) );

// Exceeding supported length, time to reduce & multiply
if ( e > 8 ) {
result = result * ( 1000 * ( e - 8 ) );
e = 8;
}

if ( base === 2 ) {
result = num / Math.pow( 2, ( e * 10 ) );
}
Expand Down Expand Up @@ -121,8 +127,8 @@ function filesize ( arg, descriptor ) {
* @type {Object}
*/
var si = {
bits : ["B", "kb", "Mb", "Gb", "Tb", "Pb"],
bytes : ["B", "kB", "MB", "GB", "TB", "PB"]
bits : ["B", "kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
bytes : ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
};

// CommonJS, AMD, script tag
Expand Down
2 changes: 1 addition & 1 deletion lib/filesize.map
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version":3,
"file":"filesize.min.js",
"lineCount":9,
"mappings":"A;;;;;;;AAUE,SAAS,CAAEA,CAAF,CAAW,CAgBtBC,QAASA,EAAS,CAAEC,CAAF,CAAOC,CAAP,CAAoB,CAAA,IACjCC,EAAS,EADwB,CAGjCC,CAHiC,CAGxBC,CAHwB,CAGlBC,CAHkB,CAGZC,CAHY,CAGPC,CAHO,CAGFC,CAHE,CAGKC,CAHL,CAGWC,CAHX,CAG8BC,CAEnE,IAAK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X,EAG8B,GAH9B,GAGmBa,CAHnB,GAICA,CAJD,CAIU,GAJV,CAWA,CAJKc,CAAAN,KAAA,CAAWG,CAAX,CAIL,GAHC1B,CAGD,CAHU8B,QAAA,CAAU9B,CAAV,CAAkB+B,CAAlB,CAGV,EAAA/B,CAAA,EAAUQ,CAAV,EAAqBC,CAAA,CAASM,CAAT,CAArB,EAAyCA,CAAzC,CAnBD,EAqBWR,CArBX,GAsBCP,CAtBD,EAsBWQ,CAtBX,EAsBsBC,CAAA,CAASM,CAAT,CAtBtB,EAsB0CA,CAtB1C,EArCD,CAgEKX,EAAL,GACCJ,CADD,CACU,GADV,CACgBA,CADhB,CAIA,OAAOA,EA9F8B,CAhBhB,IAGlBsB,EAAQ,IAHU,CAIlBS,EAAQ,EAJU,CAKlBH,EAAQ,MALU,CAMlBC,EAAQ,KANU,CAsHlBR,EAAK,MACA,2BAAA,MAAA,CAAA,GAAA,CADA,OAEA,2BAAA,MAAA,CAAA,GAAA,CAFA,CAMe,YAAxB,GAAK,MAAOW,QAAZ,CACCC,MAAAD,QADD,CACkBnC,CADlB,CAG4B,UAAvB,GAAK,MAAOqC,OAAZ,CACJA,MAAA,CAAQ,QAAS,EAAG,CACnB,MAAOrC,EADY,CAApB,CADI,CAMJD,CAAAC,SANI,CAMcA,CArIG,CAApB,CAAA,CAwIG,IAxIH;",
"sources":["filesize.js"],
"names":["global","filesize","arg","descriptor","result","e","bits","ceil","neg","num","round","unix","spacer","suffixes","isNaN","Error","base","undefined","Number","suffix","Math","floor","log","pow","toFixed","si","bit","test","toLowerCase","charAt","z","replace","left","zero","parseInt","radix","exports","module","define"]
}
6 changes: 3 additions & 3 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": "2.0.2",
"version": "2.0.3",
"homepage": "http://filesizejs.com",
"author": {
"name": "Jason Mulligan",
Expand Down
6 changes: 6 additions & 0 deletions src/filesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ function filesize ( arg, descriptor ) {
else {
e = Math.floor( Math.log( num ) / Math.log( 1000 ) );

// Exceeding supported length, time to reduce & multiply
if ( e > 8 ) {
result = result * ( 1000 * ( e - 8 ) );
e = 8;
}

if ( base === 2 ) {
result = num / Math.pow( 2, ( e * 10 ) );
}
Expand Down
4 changes: 2 additions & 2 deletions src/si.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* @type {Object}
*/
var si = {
bits : ["B", "kb", "Mb", "Gb", "Tb", "Pb"],
bytes : ["B", "kB", "MB", "GB", "TB", "PB"]
bits : ["B", "kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
bytes : ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
};

0 comments on commit a8966f8

Please sign in to comment.