Comparing version 0.2.1 to 0.3.0
0.3.0 / 2014-03-19 | ||
================== | ||
* added terabyte support | ||
0.2.1 / 2013-04-01 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -12,3 +12,3 @@ | ||
if ('number' == typeof size) return convert(size); | ||
var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/) | ||
var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb|tb)$/) | ||
, n = parseFloat(parts[1]) | ||
@@ -21,2 +21,3 @@ , type = parts[2]; | ||
, gb: 1 << 30 | ||
, tb: ((1 << 30) * 1024) | ||
}; | ||
@@ -36,3 +37,4 @@ | ||
function convert (b) { | ||
var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10; | ||
var tb = ((1 << 30) * 1024), gb = 1 << 30, mb = 1 << 20, kb = 1 << 10; | ||
if (b >= tb) return (Math.round(b / tb * 100) / 100) + 'tb'; | ||
if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb'; | ||
@@ -39,0 +41,0 @@ if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb'; |
@@ -5,3 +5,7 @@ { | ||
"description": "byte size string parser / serializer", | ||
"version": "0.2.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/visionmedia/bytes.js.git" | ||
}, | ||
"version": "0.3.0", | ||
"main": "index.js", | ||
@@ -8,0 +12,0 @@ "dependencies": {}, |
@@ -19,2 +19,5 @@ # node-bytes | ||
// => 1gb | ||
bytes(1099511627776) | ||
// => 1tb | ||
``` | ||
@@ -21,0 +24,0 @@ |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
3351
42
55
0