Socket
Socket
Sign inDemoInstall

google-flights-wrapper1

Package Overview
Dependencies
47
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

71

index.js

@@ -26,11 +26,27 @@ module.exports = function(apikey){

var destination = "";
var connectionNumber=0;
if(body.error) return console.error(body.error);
for(i=0; i < body.trips.tripOption.length; i++){
for(k=0; k<body.trips.tripOption[i].slice[0].segment.length;k++){
if(body.trips.tripOption[i].slice[0].segment.length<1){
for(k=0;k<body.trips.tripOption[i].slice[0].segment.length;k++){
for(j=0;j<body.trips.data.carrier.length;j++){
if(body.trips.data.carrier[j].code==body.trips.tripOption[i].slice[0].segment[k].flight.carrier){
airline = body.trips.data.carrier[j].name;
break;
}
}
origin = body.trips.tripOption[i].slice[0].segment[k].leg[0].origin;
destination = body.trips.tripOption[i].slice[0].segment[k].leg[0].destination;
flightNumber = body.trips.tripOption[i].slice[0].segment[k].flight.number;
price = body.trips.tripOption[i].saleTotal;
arrivalTime = body.trips.tripOption[i].slice[0].segment[k].leg[body.trips.tripOption[i].slice[0].segment[k].leg.length-1].arrivalTime;
departureTime = body.trips.tripOption[i].slice[0].segment[k].leg[0].departureTime;
connectionNumber = connectionNumber +1;
var jsonObjectConnection = {"connectionNumber: ": connectionNumber, "airline": airline , "price": price, "departureTime:":departureTime, "arrivalTime:":arrivalTime, "flightNumber:":flightNumber, "Origin: ": origin, "Destination: ":destination};
jsonObject = {jsonObject, jsonObjectConnection};
}
}else{
for(j=0;j<body.trips.data.carrier.length;j++){
if(body.trips.data.carrier[j].code==body.trips.tripOption[i].slice[0].segment[k].flight.carrier){
if(airline!=""){
airline = airline + "Connecting Airline: "+body.trips.data.carrier[j].name
}
if(body.trips.data.carrier[j].code==body.trips.tripOption[i].slice[0].segment[0].flight.carrier){
airline = body.trips.data.carrier[j].name;

@@ -40,38 +56,19 @@ break;

}
if(origin != ""){
origin = origin + "Connecting Origin: "+ body.trips.tripOption[i].slice[0].segment[k].leg[0].origin;
}else{
origin = body.trips.tripOption[i].slice[0].segment[k].leg[0].origin;
}
if(destination != ""){
destination = destination + "Connecting Destination: "+ body.trips.tripOption[i].slice[0].segment[k].leg[0].destination;
}else{
destination = body.trips.tripOption[i].slice[0].segment[k].leg[0].destination;
}
if(flightNumber != ""){
flightNumber = flightNumber + "Connecting Flight Number: "+body.trips.tripOption[i].slice[0].segment[k].flight.number;
}else{
flightNumber = body.trips.tripOption[i].slice[0].segment[k].flight.number;
}
origin = body.trips.tripOption[i].slice[0].segment[0].leg[0].origin;
destination = body.trips.tripOption[i].slice[0].segment[0].leg[0].destination;
flightNumber = body.trips.tripOption[i].slice[0].segment[0].flight.number;
price = body.trips.tripOption[i].saleTotal;
if(arrivalTime != ""){
arrivalTime = arrivalTime + "Connecting Flight Arrival Time: " + body.trips.tripOption[i].slice[0].segment[k].leg[body.trips.tripOption[i].slice[0].segment[k].leg.length-1].arrivalTime;
}else{
arrivalTime = body.trips.tripOption[i].slice[0].segment[k].leg[body.trips.tripOption[i].slice[0].segment[k].leg.length-1].arrivalTime;
}
if(departureTime != ""){
departureTime = departureTime + "Connecting Flight Departure Time: " + body.trips.tripOption[i].slice[0].segment[k].leg[0].departureTime;
}else{
departureTime = body.trips.tripOption[i].slice[0].segment[k].leg[0].departureTime;
}
arrivalTime = body.trips.tripOption[i].slice[0].segment[0].leg[body.trips.tripOption[i].slice[0].segment[0].leg.length-1].arrivalTime;
departureTime = body.trips.tripOption[i].slice[0].segment[0].leg[0].departureTime;
jsonObject = {"airline": airline , "price": price, "departureTime:":departureTime, "arrivalTime:":arrivalTime, "flightNumber:":flightNumber, "Origin: ": origin, "Destination: ":destination};
}
info.push(jsonObject);
var airline = "";
var price = "";
var arrivalTime = "";
var departureTime = "";
var flightNumber = "";
var origin = "";
var destination = "";
connectionNumber =0;
airline = "";
price = "";
arrivalTime = "";
departureTime = "";
flightNumber = "";
origin = "";
destination = "";
}

@@ -78,0 +75,0 @@ fn(info);

{
"name": "google-flights-wrapper1",
"version": "1.1.0",
"version": "1.1.1",
"description": "A simple wrapper for the Google Flights API",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc