Comparing version 2.0.0 to 2.0.1
@@ -0,6 +1,15 @@ | ||
2.0.1 / 2015-05-07 | ||
================== | ||
* fix browserify require | ||
* remove node.extend dependency | ||
2.0.0 / 2015-04-12 | ||
================== | ||
* rewrite to fix a few issues, see: https://github.com/visionmedia/bytes.js/pull/20#issuecomment-92121650 | ||
* add option "case" | ||
* add option "thousandsSeparator" | ||
* return "null" on invalid parse input | ||
* support proper round-trip: bytes(bytes(num)) === num | ||
* units no longer case sensitive when parsing | ||
@@ -7,0 +16,0 @@ 1.0.0 / 2014-05-05 |
'use strict'; | ||
var convertFunction = require(__dirname + '/lib/byte-convert.js'); | ||
var parseFunction = require(__dirname + '/lib/byte-parse.js'); | ||
var convertFunction = require('./lib/byte-convert.js'); | ||
var parseFunction = require('./lib/byte-parse.js'); | ||
@@ -6,0 +6,0 @@ /** |
'use strict'; | ||
var extend = require('node.extend'); | ||
/** | ||
* Default options. | ||
* | ||
* @type {{case: string|null, thousandsSeparator: string|null}} | ||
*/ | ||
var defaultOptions = { | ||
thousandsSeparator: '' | ||
}; | ||
/** | ||
* Convert the value given in bytes into bytes, KB, MB, GB or TB. | ||
@@ -67,10 +55,9 @@ * | ||
options = extend({}, defaultOptions, options); | ||
var converterResult = convertValue(value); | ||
var convertedValue = converterResult.value; | ||
var thousandsSeparator = (options && options.thousandsSeparator) || ''; | ||
var unit = converterResult.unit; | ||
if (options.thousandsSeparator) { | ||
convertedValue = convertedValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, options.thousandsSeparator); | ||
if (thousandsSeparator) { | ||
convertedValue = convertedValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator); | ||
} | ||
@@ -77,0 +64,0 @@ |
{ | ||
"name": "bytes", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.", | ||
@@ -28,7 +28,4 @@ "keywords": [ | ||
"scripts": { | ||
"test": "node_modules/mocha/bin/mocha --check-leaks" | ||
"test": "mocha --check-leaks --reporter spec" | ||
}, | ||
"dependencies": { | ||
"node.extend": "*" | ||
}, | ||
"devDependencies": { | ||
@@ -67,3 +64,10 @@ "chai": "*", | ||
], | ||
"files": [ | ||
"lib/", | ||
"History.md", | ||
"LICENSE", | ||
"Readme.md", | ||
"index.js" | ||
], | ||
"license": "MIT" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
0
0
0
9050
7
144
- Removednode.extend@*
- Removedfunction-bind@1.1.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis@3.3.0(transitive)
- Removednode.extend@2.0.3(transitive)