Socket
Socket
Sign inDemoInstall

content-type

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

5

HISTORY.md

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

1.0.4 / 2017-09-11
==================
* perf: skip parameter parsing when no parameters
1.0.3 / 2017-09-10

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

46

index.js

@@ -129,32 +129,36 @@ /*!

var key
var match
var obj = new ContentType(type.toLowerCase())
var value
PARAM_REGEXP.lastIndex = index
// parse parameters
if (index !== -1) {
var key
var match
var value
while ((match = PARAM_REGEXP.exec(header))) {
if (match.index !== index) {
throw new TypeError('invalid parameter format')
}
PARAM_REGEXP.lastIndex = index
index += match[0].length
key = match[1].toLowerCase()
value = match[2]
while ((match = PARAM_REGEXP.exec(header))) {
if (match.index !== index) {
throw new TypeError('invalid parameter format')
}
if (value[0] === '"') {
// remove quotes and escapes
value = value
.substr(1, value.length - 2)
.replace(QESC_REGEXP, '$1')
index += match[0].length
key = match[1].toLowerCase()
value = match[2]
if (value[0] === '"') {
// remove quotes and escapes
value = value
.substr(1, value.length - 2)
.replace(QESC_REGEXP, '$1')
}
obj.parameters[key] = value
}
obj.parameters[key] = value
if (index !== header.length) {
throw new TypeError('invalid parameter format')
}
}
if (index !== -1 && index !== header.length) {
throw new TypeError('invalid parameter format')
}
return obj

@@ -161,0 +165,0 @@ }

{
"name": "content-type",
"description": "Create and parse HTTP Content-Type header",
"version": "1.0.3",
"version": "1.0.4",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",

@@ -6,0 +6,0 @@ "license": "MIT",

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