Comparing version 1.2.0 to 1.2.2
48
index.js
@@ -1,30 +0,32 @@ | ||
(function (global, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
define([], factory); | ||
} else if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = factory(); | ||
} else { | ||
global.siz = factory(); | ||
(function(global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define([], factory); | ||
} else if (typeof module !== "undefined" && module.exports) { | ||
module.exports = factory(); | ||
} else { | ||
global.siz = factory(); | ||
} | ||
})(this, function() { | ||
function siz(size) { | ||
var num = parseInt(size); | ||
if (/[0-9]*k(b|B)?/gi.test(size)) { | ||
return num * 1024; | ||
} | ||
})(this, function () { | ||
function siz(size) { | ||
var num = parseInt(size); | ||
if (/[0-9]*k(b|B)?/ig.test(size)) { | ||
return num * 1024; | ||
} | ||
if (/[0-9]*m(b|B)?/ig.test(size)) { | ||
return num * 1024 * 1024; | ||
} | ||
if (/[0-9]*m(b|B)?/gi.test(size)) { | ||
return num * 1024 * 1024; | ||
} | ||
if (/[0-9]*g(b|B)?/ig.test(size)) { | ||
return num * 1024 * 1024 * 1024; | ||
} | ||
if (/[0-9]*g(b|B)?/gi.test(size)) { | ||
return num * 1024 * 1024 * 1024; | ||
} | ||
if (/[0-9]*t(b|B)?/ig.test(size)) { | ||
return num * 1024 * 1024 * 1024 * 1024; | ||
} | ||
if (/[0-9]*t(b|B)?/gi.test(size)) { | ||
return num * 1024 * 1024 * 1024 * 1024; | ||
} | ||
return siz; | ||
return num; | ||
} | ||
return siz; | ||
}); |
@@ -8,7 +8,7 @@ { | ||
], | ||
"author": "a-jie <ajiemath@gmail.com>", | ||
"author": "drawcall <ajiemath@gmail.com>", | ||
"main": "index.js", | ||
"version": "1.2.0", | ||
"version": "1.2.2", | ||
"devDependencies": {}, | ||
"license": "MIT" | ||
} |
27
1365