Socket
Socket
Sign inDemoInstall

bytes

Package Overview
Dependencies
0
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.1.0

5

History.md

@@ -0,1 +1,6 @@

3.1.0 / 2019-01-22
==================
* Add petabyte (`pb`) support
3.0.0 / 2017-08-31

@@ -2,0 +7,0 @@ ==================

9

index.js

@@ -33,6 +33,7 @@ /*!

gb: 1 << 30,
tb: ((1 << 30) * 1024)
tb: Math.pow(1024, 4),
pb: Math.pow(1024, 5),
};
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i;
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;

@@ -97,3 +98,5 @@ /**

if (!unit || !map[unit.toLowerCase()]) {
if (mag >= map.tb) {
if (mag >= map.pb) {
unit = 'PB';
} else if (mag >= map.tb) {
unit = 'TB';

@@ -100,0 +103,0 @@ } else if (mag >= map.gb) {

{
"name": "bytes",
"description": "Utility to parse a string bytes to bytes and vice-versa",
"version": "3.0.0",
"version": "3.1.0",
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",

@@ -22,4 +22,5 @@ "contributors": [

"devDependencies": {
"mocha": "2.5.3",
"nyc": "10.3.2"
"eslint": "5.12.1",
"mocha": "5.2.0",
"nyc": "13.1.0"
},

@@ -36,2 +37,3 @@ "files": [

"scripts": {
"lint": "eslint .",
"test": "mocha --check-leaks --reporter spec",

@@ -38,0 +40,0 @@ "test-ci": "nyc --reporter=text npm test",

@@ -86,2 +86,3 @@ # Bytes utility

* `tb` for terabytes
* `pb` for petabytes

@@ -112,3 +113,3 @@ The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.

bytes(1024);
// output: 1024
// output: 1KB
```

@@ -120,9 +121,9 @@

[downloads-image]: https://img.shields.io/npm/dm/bytes.svg
[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
[downloads-image]: https://badgen.net/npm/dm/bytes
[downloads-url]: https://npmjs.org/package/bytes
[npm-image]: https://img.shields.io/npm/v/bytes.svg
[npm-image]: https://badgen.net/npm/node/bytes
[npm-url]: https://npmjs.org/package/bytes
[travis-image]: https://img.shields.io/travis/visionmedia/bytes.js/master.svg
[travis-image]: https://badgen.net/travis/visionmedia/bytes.js/master
[travis-url]: https://travis-ci.org/visionmedia/bytes.js
[coveralls-image]: https://img.shields.io/coveralls/visionmedia/bytes.js/master.svg
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc