UNPKG

tfl-journey-planner

Version:
1 lines 492 B
var request,querystring;request=require("request"),querystring=require("querystring"),module.exports=function(t,r,e){var o;return o="https://api.tfl.gov.uk/Journey/JourneyResults","string"==typeof t.from?o+="/"+t.from:"object"==typeof t.from&&(o+="/"+t.from.lat+","+t.from.lng),"string"==typeof t.to?o+="/to/"+t.to:"object"==typeof t.to&&(o+="/to/"+t.to.lat+","+t.to.lng),o+="?"+querystring.stringify(r),request({url:o,json:!0},function(t,r,o){if(t||200!==r.statusCode)throw t;return e(o)})};