X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/267d5108c3de7c23120a2d29f6cfba9e4ac90d46..fdd44e543a8f760c11c186fd27f04b721a043fce:/src/assets/js/base.js diff --git a/src/assets/js/base.js b/src/assets/js/base.js index 90a3588..27f93af 100644 --- a/src/assets/js/base.js +++ b/src/assets/js/base.js @@ -61,10 +61,13 @@ function map_viewbox_as_string() { // ********************************************************* function fetch_from_api(endpoint_name, params, callback) { - // `&a=&b=&c=1` => '&c=' - for (var k in params) { - if (typeof (params[k]) === 'undefined' || params[k] === '' || params[k] === null) { - delete params[k]; + // + // `&a=&b=&c=1` => '&c=1' + var param_names = Object.keys(params); + for (var i = 0; i < param_names.length; i += 1) { + var val = params[param_names[i]]; + if (typeof (val) === 'undefined' || val === '' || val === null) { + delete params[param_names[i]]; } }