Comparing version 2.3.2 to 2.3.3
## [**2.3.3**](https://github.com/hapijs/qs/issues?milestone=18&state=open) | ||
- [**#59**](https://github.com/hapijs/qs/issues/59) make sure array indexes are >= 0, closes #57 | ||
- [**#58**](https://github.com/hapijs/qs/issues/58) make qs usable for browser loader | ||
## [**2.3.2**](https://github.com/hapijs/qs/issues?milestone=17&state=closed) | ||
- [**#55**](https://github.com/hapijs/qs/issues/55) allow merging a string into an object | ||
## [**2.3.1**](https://github.com/hapijs/qs/issues?milestone=16&state=closed) | ||
@@ -3,0 +10,0 @@ - [**#52**](https://github.com/hapijs/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError". |
@@ -1,1 +0,1 @@ | ||
module.exports = require('./lib'); | ||
module.exports = require('./lib/'); |
@@ -65,2 +65,3 @@ // Load modules | ||
indexString === cleanRoot && | ||
index >= 0 && | ||
index <= options.arrayLimit) { | ||
@@ -67,0 +68,0 @@ |
@@ -97,3 +97,3 @@ // Load modules | ||
for (var i = 0, l = obj.length; i < l; ++i) { | ||
for (var i = 0, il = obj.length; i < il; ++i) { | ||
if (typeof obj[i] !== 'undefined') { | ||
@@ -108,3 +108,3 @@ compacted.push(obj[i]); | ||
var keys = Object.keys(obj); | ||
for (var i = 0, il = keys.length; i < il; ++i) { | ||
for (i = 0, il = keys.length; i < il; ++i) { | ||
var key = keys[i]; | ||
@@ -111,0 +111,0 @@ obj[key] = exports.compact(obj[key], refs); |
{ | ||
"name": "qs", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "A querystring parser that supports nesting and arrays, with a depth limit", | ||
@@ -9,3 +9,4 @@ "homepage": "https://github.com/hapijs/qs", | ||
"devDependencies": { | ||
"lab": "4.x.x" | ||
"code": "1.x.x", | ||
"lab": "5.x.x" | ||
}, | ||
@@ -12,0 +13,0 @@ "scripts": { |
@@ -156,2 +156,4 @@ # qs | ||
To disable array parsing entirely, set `arrayLimit` to `-1`. | ||
If you mix notations, **qs** will merge the two items into an object: | ||
@@ -158,0 +160,0 @@ |
@@ -0,3 +1,5 @@ | ||
/* eslint no-extend-native:0 */ | ||
// Load modules | ||
var Code = require('code'); | ||
var Lab = require('lab'); | ||
@@ -15,3 +17,3 @@ var Qs = require('../'); | ||
var lab = exports.lab = Lab.script(); | ||
var expect = Lab.expect; | ||
var expect = Code.expect; | ||
var describe = lab.experiment; | ||
@@ -306,2 +308,4 @@ var it = lab.test; | ||
expect(Qs.parse('a[0]=b', { arrayLimit: -1 })).to.deep.equal({ a: { '0': 'b' } }); | ||
expect(Qs.parse('a[-1]=b', { arrayLimit: -1 })).to.deep.equal({ a: { '-1': 'b' } }); | ||
expect(Qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 })).to.deep.equal({ a: { '0': 'b', '1': 'c' } }); | ||
@@ -314,10 +318,10 @@ done(); | ||
var input = { | ||
"user[name]": {"pop[bob]": 3}, | ||
"user[email]": null | ||
'user[name]': {'pop[bob]': 3}, | ||
'user[email]': null | ||
}; | ||
var expected = { | ||
"user": { | ||
"name": {"pop[bob]": 3}, | ||
"email": null | ||
'user': { | ||
'name': {'pop[bob]': 3}, | ||
'email': null | ||
} | ||
@@ -335,10 +339,10 @@ }; | ||
var input = { | ||
"user[name]": {"pop[bob]": { "test": 3 }}, | ||
"user[email]": null | ||
'user[name]': {'pop[bob]': { 'test': 3 }}, | ||
'user[email]': null | ||
}; | ||
var expected = { | ||
"user": { | ||
"name": {"pop[bob]": { "test": 3 }}, | ||
"email": null | ||
'user': { | ||
'name': {'pop[bob]': { 'test': 3 }}, | ||
'email': null | ||
} | ||
@@ -357,4 +361,5 @@ }; | ||
delete global.Buffer; | ||
expect(Qs.parse('a=b&c=d')).to.deep.equal({ a: 'b', c: 'd' }); | ||
var result = Qs.parse('a=b&c=d'); | ||
global.Buffer = tempBuffer; | ||
expect(result).to.deep.equal({ a: 'b', c: 'd' }); | ||
done(); | ||
@@ -379,6 +384,6 @@ }); | ||
parsed = Qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a }); | ||
}).to.not.throw(Error); | ||
}).to.not.throw(); | ||
expect(parsed).to.have.key('foo'); | ||
expect(parsed.foo).to.have.keys('bar', 'baz'); | ||
expect(parsed).to.contain('foo'); | ||
expect(parsed.foo).to.contain('bar', 'baz'); | ||
expect(parsed.foo.bar).to.equal('baz'); | ||
@@ -395,3 +400,5 @@ expect(parsed.foo.baz).to.deep.equal(a); | ||
expect(Qs.parse(a)).to.deep.equal({ b: 'c' }); | ||
expect(Qs.parse({ a: a })).to.deep.equal({ a: { b: 'c' } }); | ||
var result = Qs.parse({ a: a }); | ||
expect(result).to.contain('a'); | ||
expect(result.a).to.deep.equal(a); | ||
done(); | ||
@@ -398,0 +405,0 @@ }); |
@@ -0,3 +1,5 @@ | ||
/* eslint no-extend-native:0 */ | ||
// Load modules | ||
var Code = require('code'); | ||
var Lab = require('lab'); | ||
@@ -15,3 +17,3 @@ var Qs = require('../'); | ||
var lab = exports.lab = Lab.script(); | ||
var expect = Lab.expect; | ||
var expect = Code.expect; | ||
var describe = lab.experiment; | ||
@@ -18,0 +20,0 @@ var it = lab.test; |
Sorry, the diff of this file is not supported yet
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
39422
697
223
2