querystringify
Advanced tools
Comparing version 1.0.0 to 2.0.0
21
index.js
@@ -28,12 +28,15 @@ 'use strict'; | ||
// | ||
// Little nifty parsing hack, leverage the fact that RegExp.exec increments | ||
// the lastIndex property so we can continue executing this loop until we've | ||
// parsed all results. | ||
// | ||
for (; | ||
part = parser.exec(query); | ||
result[decode(part[1])] = decode(part[2]) | ||
); | ||
while (part = parser.exec(query)) { | ||
var key = decode(part[1]) | ||
, value = decode(part[2]); | ||
// | ||
// Prevent overriding of existing properties. This ensures that build-in | ||
// methods like `toString` or __proto__ are not overriden by malicious | ||
// querystrings. | ||
// | ||
if (key in result) continue; | ||
result[key] = value; | ||
} | ||
return result; | ||
@@ -40,0 +43,0 @@ } |
{ | ||
"name": "querystringify", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Querystringify - Small, simple but powerful query string parser.", | ||
@@ -34,7 +34,7 @@ "main": "index.js", | ||
"devDependencies": { | ||
"assume": "1.4.x", | ||
"istanbul": "0.4.x", | ||
"mocha": "~3.2.0", | ||
"pre-commit": "~1.2.0" | ||
"assume": "^2.0.1", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^5.1.1", | ||
"pre-commit": "^1.2.2" | ||
} | ||
} |
6242
63