querystring
Advanced tools
Comparing version 0.0.1 to 0.0.4
@@ -1,5 +0,7 @@ | ||
0.0.1 / 2010-01-03 | ||
================== | ||
* Initial release | ||
# 0.0.3 / 2011-04-16 # | ||
- Support for AMD module loaders | ||
# 0.0.2 / 2011-04-16 # | ||
- Ported unit tests | ||
- Removed functionality that depended on Buffers | ||
# 0.0.1 / 2011-04-15 # | ||
- Initial release |
@@ -24,2 +24,3 @@ // Copyright Joyent, Inc. and other Node contributors. | ||
(typeof define === "undefined" ? function($) { $(require, exports, module) } : define)(function(require, exports, module, undefined) { | ||
"use strict"; | ||
@@ -33,79 +34,5 @@ | ||
QueryString.unescape = decodeURIComponent; | ||
QueryString.escape = encodeURIComponent; | ||
// a safe fast alternative to decodeURIComponent | ||
QueryString.unescapeBuffer = function(s, decodeSpaces) { | ||
var out = new Buffer(s.length); | ||
var state = 'CHAR'; // states: CHAR, HEX0, HEX1 | ||
var n, m, hexchar; | ||
for (var inIndex = 0, outIndex = 0; inIndex <= s.length; inIndex++) { | ||
var c = s.charCodeAt(inIndex); | ||
switch (state) { | ||
case 'CHAR': | ||
switch (c) { | ||
case charCode('%'): | ||
n = 0; | ||
m = 0; | ||
state = 'HEX0'; | ||
break; | ||
case charCode('+'): | ||
if (decodeSpaces) c = charCode(' '); | ||
// pass thru | ||
default: | ||
out[outIndex++] = c; | ||
break; | ||
} | ||
break; | ||
case 'HEX0': | ||
state = 'HEX1'; | ||
hexchar = c; | ||
if (charCode('0') <= c && c <= charCode('9')) { | ||
n = c - charCode('0'); | ||
} else if (charCode('a') <= c && c <= charCode('f')) { | ||
n = c - charCode('a') + 10; | ||
} else if (charCode('A') <= c && c <= charCode('F')) { | ||
n = c - charCode('A') + 10; | ||
} else { | ||
out[outIndex++] = charCode('%'); | ||
out[outIndex++] = c; | ||
state = 'CHAR'; | ||
break; | ||
} | ||
break; | ||
case 'HEX1': | ||
state = 'CHAR'; | ||
if (charCode('0') <= c && c <= charCode('9')) { | ||
m = c - charCode('0'); | ||
} else if (charCode('a') <= c && c <= charCode('f')) { | ||
m = c - charCode('a') + 10; | ||
} else if (charCode('A') <= c && c <= charCode('F')) { | ||
m = c - charCode('A') + 10; | ||
} else { | ||
out[outIndex++] = charCode('%'); | ||
out[outIndex++] = hexchar; | ||
out[outIndex++] = c; | ||
break; | ||
} | ||
out[outIndex++] = 16 * n + m; | ||
break; | ||
} | ||
} | ||
// TODO support returning arbitrary buffers. | ||
return out.slice(0, outIndex - 1); | ||
}; | ||
QueryString.unescape = function(s, decodeSpaces) { | ||
return QueryString.unescapeBuffer(s, decodeSpaces).toString(); | ||
}; | ||
QueryString.escape = function(str) { | ||
return encodeURIComponent(str); | ||
}; | ||
var stringifyPrimitive = function(v) { | ||
@@ -183,1 +110,2 @@ switch (typeof v) { | ||
}); |
{ "name": "querystring", | ||
"version": "0.0.1", | ||
"id": "querystring", | ||
"version": "0.0.4", | ||
"description": "Node's querystring module for all engines.", | ||
"keywords": [ "query", "querystring" ], | ||
"keywords": [ "commonjs", "query", "querystring" ], | ||
"author": "Irakli Gozalishvili <rfobic@gmail.com>", | ||
@@ -20,3 +21,3 @@ "repository": { | ||
"devDependencies": { | ||
"test": ">=0.0.10" | ||
"test": ">=0.4.0" | ||
}, | ||
@@ -29,10 +30,4 @@ "main": "./lib/querystring.js", | ||
"scripts": { | ||
"test": "node test/test-querystring.js" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type" : "MPL 1.1/LGPL 2.1/GPL 2.0", | ||
"url" : "http://www.mozilla.org/MPL/" | ||
} | ||
] | ||
"test": "node tests/test-querystring.js" | ||
} | ||
} |
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
145978
9
269
2