Comparing version 0.1.0 to 0.1.1
21
index.js
@@ -0,1 +1,3 @@ | ||
var bytes = require('bytes') | ||
module.exports = function (stream, options, done) { | ||
@@ -5,15 +7,16 @@ if (typeof options === 'function') { | ||
options = {} | ||
} else if (!options) { | ||
options = {} | ||
} | ||
if (!options) | ||
options = {} | ||
var limit = null | ||
if (typeof options.limit === 'number') | ||
limit = options.limit | ||
if (typeof options.limit === 'string') | ||
limit = bytes(options.limit) | ||
var limit = typeof options.limit === 'number' | ||
? options.limit | ||
: null | ||
var expected = null | ||
if (!isNaN(options.expected)) | ||
expected = parseInt(options.expected, 10) | ||
var expected = !isNaN(options.expected) | ||
? parseInt(options.expected, 10) | ||
: null | ||
if (limit !== null && expected !== null && expected > limit) { | ||
@@ -20,0 +23,0 @@ var err = new Error('request entity too large') |
{ | ||
"name": "raw-body", | ||
"description": "Get and validate the raw body of a readable stream.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": { | ||
@@ -20,2 +20,5 @@ "name": "Jonathan Ong", | ||
}, | ||
"dependencies": { | ||
"bytes": "~0.2.1" | ||
}, | ||
"devDependencies": { | ||
@@ -22,0 +25,0 @@ "co": "*", |
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
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
5173
69
1
+ Addedbytes@~0.2.1
+ Addedbytes@0.2.1(transitive)