Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mapbox

Package Overview
Dependencies
Maintainers
45
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapbox - npm Package Compare versions

Comparing version 0.9.0 to 0.10.0

2

API.md

@@ -387,3 +387,3 @@ ## `MapboxClient`

var mapboxClient = new MapboxClient('ACCESSTOKEN');
mapboxClient.directions(
mapboxClient.getDirections(
[

@@ -390,0 +390,0 @@ { latitude: 33.6, longitude: -95.4431 },

@@ -7,3 +7,3 @@ // We keep all of the constants that declare endpoints in one

module.exports.API_GEOCODER_REVERSE = '/geocoding/v5/{dataset}/{longitude},{latitude}.json';
module.exports.API_DIRECTIONS = '/v4/directions/{profile}/{encodedWaypoints}.json';
module.exports.API_DIRECTIONS = '/v4/directions/{profile}/{encodedWaypoints}.json{?alternatives,instructions,geometry,steps}';
module.exports.API_DISTANCE = '/distances/v1/mapbox/{profile}';

@@ -10,0 +10,0 @@ module.exports.API_SURFACE = '/v4/surface/{mapid}.json{?layer,fields,points,geojson,interpolate,encoded_polyline}';

@@ -43,3 +43,3 @@ 'use strict';

* var mapboxClient = new MapboxClient('ACCESSTOKEN');
* mapboxClient.directions(
* mapboxClient.getDirections(
* [

@@ -82,2 +82,3 @@ * { latitude: 33.6, longitude: -95.4431 },

alternatives = true,
steps = true,
geometry = 'geojson',

@@ -91,7 +92,12 @@ instructions = 'text';

if (options.instructions) {
assert(typeof options.instructions === 'string', 'instructions option must be string');
instructions = options.instructions;
if (typeof options.alternatives !== 'undefined') {
assert(typeof options.alternatives === 'boolean', 'alternatives option must be boolean');
alternatives = options.alternatives;
}
if (typeof options.steps !== 'undefined') {
assert(typeof options.steps === 'boolean', 'steps option must be boolean');
steps = options.steps;
}
if (options.geometry) {

@@ -102,2 +108,7 @@ assert(typeof options.geometry === 'string', 'geometry option must be string');

if (options.instructions) {
assert(typeof options.instructions === 'string', 'instructions option must be string');
instructions = options.instructions;
}
this.client({

@@ -110,3 +121,4 @@ path: constants.API_DIRECTIONS,

geometry: geometry,
alternatives: alternatives
alternatives: alternatives,
steps: steps
},

@@ -113,0 +125,0 @@ callback: callback

{
"name": "mapbox",
"version": "0.9.0",
"version": "0.10.0",
"description": "interface to mapbox services",

@@ -5,0 +5,0 @@ "main": "lib/mapbox.js",

@@ -42,5 +42,36 @@ /* eslint no-shadow: 0 */

t.test('assert options', function(t) {
var client = new MapboxClient(process.env.MapboxAccessToken);
t.ok(client);
var tester = { client: function(opts) {
var params = opts.params;
t.equals(params.profile, 'mapbox.walking', 'profile as walking is set');
t.equals(params.geometry, 'polyline', 'geometry as polyline is set');
t.equals(params.instructions, 'html', 'instructions as HTML is set');
t.notOk(params.alternatives, 'alternatives option is set to false');
t.notOk(params.steps, 'steps option is set to false');
opts.callback();
}};
client.getDirections.apply(tester, [[
{ latitude: 33.6875431, longitude: -95.4431142 },
{ latitude: 33.6875431, longitude: -95.4831142 }
], {
profile: 'mapbox.walking',
alternatives: false,
steps: false,
geometry: 'polyline',
instructions: 'html'
}, function(err) {
t.ifError(err);
t.end();
}]);
});
t.test('all options', function(t) {
var client = new MapboxClient(process.env.MapboxAccessToken);
t.ok(client);
client.getDirections([

@@ -51,5 +82,6 @@ { latitude: 33.6875431, longitude: -95.4431142 },

profile: 'mapbox.walking',
instructions: 'html',
alternatives: false,
geometry: 'polyline'
steps: false,
geometry: 'polyline',
instructions: 'html'
}, function(err, results) {

@@ -56,0 +88,0 @@ t.ifError(err);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc