Skip to content

_.toQuery fails on empty arrays, _.fromQuery fails on empty params #217

@viperet

Description

@viperet

When I try to convert object, consisting of empty arrays - _.toQuery() gives me && in place of them:
_.toQuery({a:[], b:[], c:[]})
"&&"
But it should return just empty string or "a=&b=&c=", not just ampersands.
And when I try to convert such query string back with _.fromQuery - it fails with JS error
'underscore-contrib.min.js:8Uncaught TypeError: Cannot read property 'replace' of undefined'

see jsfiddle https://jsfiddle.net/cp3p7jkc/

Metadata

Metadata

Assignees

Labels

before modulesThis needs to be tackled before modularization (temporary label, see #220)bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions