New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] parsing a field that holds array of arrays #335
Conversation
lib/parse.js
Outdated
@@ -87,6 +87,10 @@ var parseValues = function parseQueryStringValues(str, options) { | |||
val = val.split(','); | |||
} | |||
|
|||
if(part.indexOf('[]=') > -1){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(part.indexOf('[]=') > -1){ | |
if (part.indexOf('[]=') > -1) { |
what happens with foo[][]=bar
, or just []=a
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foo[][]=bar
will be parsed to { foo: ['bar'] }
[]=a
will be parsed to { 0: 'a' }
my code doesn't affect these results, it will be the same result
lib/utils.js
Outdated
@@ -1,7 +1,10 @@ | |||
'use strict'; | |||
|
|||
var has = Object.prototype.hasOwnProperty; | |||
var isArray = Array.isArray; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, turns out we already depended on this being available ¯\_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljharb yes it is being used in stringify.js file too =D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljharb
should i revert my changes on utils file and make another pr to replace Array.isArray with the polyfill across all the files ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah for now just use Array.isArray the same way it's used in stringify.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, will revert my is changes for using this pollyfill
3da589c
to
f884e2d
Compare
fixes #327