A simple utility to calculate route between multiple CEPs.
import getRoute from 'get-route';
...
const ceps = ['04336000', '04335000'];
const response = await getRoute(ceps);
console.log(response);
{
ok: true,
distance: '1,2 km',
distanceRaw: 1179,
time: '5 min',
timeRaw: 283
}
argument |
required |
default |
accepted values |
ceps |
true |
none |
array of strings (valid ceps) |
mode |
false |
'driving' |
either 'driving' or 'walking' |
property |
type |
explanation |
ok |
boolean |
returns true if successful, otherwise returns false |
distance |
string |
formatted distance (in kilometers). e.g.: "5,5 km" |
distanceRaw |
number |
distance in meters. e.g.: 5497 |
time |
string |
formatted time (in minutes/hours/days). e.g.: "17 min" |
timeRaw |
number |
time in seconds. e.g.: 1049 |