Socket
Socket
Sign inDemoInstall

googlemaps

Package Overview
Dependencies
2
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.9 to 0.1.10

26

lib/googlemaps.js

@@ -147,3 +147,4 @@ var qs = require('querystring'),

// http://code.google.com/apis/maps/documentation/directions/
exports.directions = function(origin, destination, callback, sensor, mode, waypoints, alternatives, avoid, units, language) {
// departureTime and arrivalTime must be passed as UNIX timestamp => Math.floor((new Date()).getTime()/1000)
exports.directions = function(origin, destination, callback, sensor, mode, waypoints, alternatives, avoid, units, language, departureTime, arrivalTime) {
var args = {

@@ -154,2 +155,25 @@ 'origin': origin,

if (mode) args.mode = mode;
// for mode transit you MUST pass either departur or arrival time
if (mode === 'transit' && ((typeof departureTime === "undefined" || departureTime === null) && (typeof arrivalTime === "undefined" || arrivalTime === null))) {
var error = new Error('If you set the mode to "transit" you must also specify either a departure_time or an arrival_time');
if (typeof callback === 'funciton') {
return callback(error);
}
else {
throw error;
}
}
if (typeof departureTime !== "undefined" && departureTime !== null) {
if (mode === 'transit' || mode === 'driving') {
args.departure_time = departureTime
if (typeof arrivalTime !== "undefined" && arrivalTime !== null) {
args.arrival_time = arrivalTime
}
}
}
if (waypoints) args.waypoints = waypoints;

@@ -156,0 +180,0 @@ if (alternatives) args.alternatives = alternatives;

2

package.json
{
"name": "googlemaps",
"version": "0.1.9",
"version": "0.1.10",
"main": "./lib/googlemaps",

@@ -5,0 +5,0 @@ "description": "A simple way to query the Google Maps API from Node.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc