mapbox
Version:
interface to mapbox services
23 lines (19 loc) • 646 B
JavaScript
;
var invariantLocation = require('./invariant_location');
/**
* Format waypionts in a way that's friendly to the directions and surface
* API: comma-separated latitude, longitude pairs with semicolons between
* them.
* @private
* @param {Array<Object>} waypoints array of objects with latitude and longitude
* properties
* @returns {string} formatted points
* @throws {Error} if the input is invalid
*/
function formatPoints(waypoints) {
return waypoints.map(function(location) {
invariantLocation(location);
return location.longitude + ',' + location.latitude;
}).join(';');
}
module.exports = formatPoints;