Socket
Socket
Sign inDemoInstall

bytes

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bytes - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

5

History.md
0.3.0 / 2014-03-19
==================
* added terabyte support
0.2.1 / 2013-04-01

@@ -3,0 +8,0 @@ ==================

6

index.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc