Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions leaflet.photon.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ L.PhotonBase = L.Class.extend({
buildQueryString: function (params) {
var queryString = [];
for (var key in params) {
if (params[key]) {
queryString.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
if (params[key] && (typeof(params[key]) == 'string' || typeof(params[key]) == 'number')) {
queryString.push(encodeURIComponent(key) + '=' + params[key]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be factorized with the line 38.
Basically I think the pattern is to always process an array, and turn the param in an array when it's not.

} else if (params[key] && params[key].length) {
for (i = 0; i < params[key].length; i++) {
queryString.push(encodeURIComponent(key) + '=' + params[key][i]);
}
}
}
return queryString.join('&');
Expand Down Expand Up @@ -372,7 +376,7 @@ L.PhotonSearch = L.PhotonBaseSearch.extend({
},

_onSelected: function (feature) {
this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]], 16);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unrelated to the current topic.

this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]]);
},

getParams: function () {
Expand Down