Comparing version 0.0.1 to 0.0.2
@@ -9,3 +9,3 @@ /** | ||
exports.qs = function (obj) { | ||
exports.encode = function (obj) { | ||
var str = ''; | ||
@@ -30,3 +30,3 @@ | ||
exports.qsParse = function(qs){ | ||
exports.decode = function(qs){ | ||
var qry = {}; | ||
@@ -33,0 +33,0 @@ var pairs = qs.split('&'); |
{ | ||
"name": "parseqs", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Provides methods for parsing a query string into an object, and vice versa.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
12
test.js
@@ -9,7 +9,7 @@ var assert = require('better-assert'); | ||
// Single assignment | ||
var queryObj = util.qsParse("foo=bar"); | ||
var queryObj = util.decode("foo=bar"); | ||
expect(queryObj.foo).to.be("bar"); | ||
// Multiple assignments | ||
queryObj = util.qsParse("france=paris&germany=berlin"); | ||
queryObj = util.decode("france=paris&germany=berlin"); | ||
expect(queryObj.france).to.be("paris"); | ||
@@ -19,3 +19,3 @@ expect(queryObj.germany).to.be("berlin"); | ||
// Assignments containing non-alphanumeric characters | ||
queryObj = util.qsParse("india=new%20delhi"); | ||
queryObj = util.decode("india=new%20delhi"); | ||
expect(queryObj.india).to.be("new delhi"); | ||
@@ -25,6 +25,6 @@ }); | ||
it('should construct a query string from an object', function () { | ||
expect(util.qs({ a: 'b' })).to.be('a=b'); | ||
expect(util.qs({ a: 'b', c: 'd' })).to.be('a=b&c=d'); | ||
expect(util.qs({ a: 'b', c: 'tobi rocks' })).to.be('a=b&c=tobi%20rocks'); | ||
expect(util.encode({ a: 'b' })).to.be('a=b'); | ||
expect(util.encode({ a: 'b', c: 'd' })).to.be('a=b&c=d'); | ||
expect(util.encode({ a: 'b', c: 'tobi rocks' })).to.be('a=b&c=tobi%20rocks'); | ||
}); | ||
}); |
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
2002