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. 8
      sanitiser/_geo.js

8
sanitiser/_geo.js

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

Loading…
Cancel
Save