Browse Source

flatten non-IO bound code

pull/12/head
Peter Johnson 10 years ago
parent
commit
0b45036bce
  1. 8
      controller/suggest.js

8
controller/suggest.js

@ -29,15 +29,13 @@ function setup( backend, query ){
} }
// convert docs to geojson // convert docs to geojson
geoJsonifyDocs( docs, function( geojson ){ var geojson = geoJsonifyDocs( docs );
// response envelope // response envelope
geojson.date = new Date().getTime(); geojson.date = new Date().getTime();
// respond // respond
return res.status(200).json( geojson ); return res.status(200).json( geojson );
});
}); });
} }
@ -45,7 +43,7 @@ function setup( backend, query ){
return controller; return controller;
} }
function geoJsonifyDocs( docs, cb ){ function geoJsonifyDocs( docs ){
// emit a warning if the doc format is invalid // emit a warning if the doc format is invalid
// @note: if you see this error, fix it ASAP! // @note: if you see this error, fix it ASAP!
@ -82,7 +80,7 @@ function geoJsonifyDocs( docs, cb ){
}); });
// convert to geojson // convert to geojson
GeoJSON.parse( geodata, { Point: ['lat', 'lng'] }, cb ); return GeoJSON.parse( geodata, { Point: ['lat', 'lng'] } );
} }
module.exports = setup; module.exports = setup;
Loading…
Cancel
Save