Browse Source

Replace array iteration boilerplate with .map

Keeps the focus of the code on the actions to be performed, rather than
the grunt work of iterating through the array.
pull/178/head
Julian Simioni 9 years ago
parent
commit
17ba5da6d5
  1. 10
      sanitiser/_geo.js

10
sanitiser/_geo.js

@ -50,14 +50,10 @@ function sanitize_bbox( clean, param ) {
var bboxArr = param.split( ',' ); var bboxArr = param.split( ',' );
if( Array.isArray( bboxArr ) && bboxArr.length === 4 ) { if( Array.isArray( bboxArr ) && bboxArr.length === 4 ) {
var bbox = bboxArr.map(parseFloat);
var bbox = []; if (bbox.some(isNaN)) {
for( var ind = 0; ind < bboxArr.length; ind++ ){ return;
var num = parseFloat( bboxArr[ ind ] );
if( isNaN( num ) ){
return;
}
bbox.push( num );
} }
clean.bbox = { clean.bbox = {

Loading…
Cancel
Save