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

foodie

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

foodie - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

75

index.js

@@ -0,4 +1,6 @@

#!/usr/bin/env node
const readline = require("readline");
const fetch = require("node-fetch");
var apiKey = process.env.npm_package_config_apiKey;
var apiKey1 = process.env.npm_package_config_apiKey1;
var apiKey2 = process.env.npm_package_config_apiKey1;
var wifiscanner = require('node-wifiscanner')

@@ -26,19 +28,18 @@

const wifiScan = (food) =>{
wifiscanner.scan(function(err, data){
if (err) {
console.log("Error : " + err);
return;
}
return sortMacs(data, food);
});
if(apiKey1){
wifiscanner.scan(function(err, data){
if (err) {
console.log("Error : " + err);
return;
}
return formatMacs(data, food);
});
} else {
console.log('No API key found. Please add API key.')
rl.close()
}
}
const sortMacs = (data, food) =>{
var macs = data.sort((a,b)=>{
if (parseInt(a.signal_level) > parseInt(b.signal_level)){
return -1
} else {
return 1
}
}).slice(0, 3).map(x=>{
const formatMacs = (data, food) =>{
var macs = data.map(x=>{
var obj = {}

@@ -59,3 +60,3 @@ obj['macAddress'] = x.mac

}
fetch("https://www.googleapis.com/geolocation/v1/geolocate?key=" + apiKey, {
fetch("https://www.googleapis.com/geolocation/v1/geolocate?key=" + apiKey1, {
method: "post",

@@ -77,3 +78,4 @@ headers: {

} else {
console.log('Location not found. Please try again.')
clearInterval(interval)
console.log('\nLocation not found. Please try again.')
rl.question("What are you hungry for? ", function(food) {

@@ -83,5 +85,7 @@ interval= kirby();

});
}
placeSearch(here, 15, food)
}});
}
}}).catch((err)=> {
console.log('Error: ' + err)
rl.close()
})

@@ -91,2 +95,3 @@ }

const placeSearch = (here, radius, food) => {
var apiKey = apiKey2 ? apiKey2 : apiKey1
var url = "https://maps.googleapis.com/maps/api/place/textsearch/json?query=" + food + "&location=" + here['lat'] + "," + here['lng'] + "&radius=" + radius + "&key=" + apiKey;

@@ -106,3 +111,6 @@

mySort(data, 'closest')
});
}).catch((err)=> {
console.log('Error: ' + err)
rl.close()
})
};

@@ -127,3 +135,3 @@

var isOpen = x.opening_hours && x.opening_hours.open_now ? 'Open' : 'Closed';
var isLast = i !== newArr.length - 1 ? `\n${line}` : '\n\n';
var isLast = i !== newArr.length - 1 ? `\n${line}` : '';
var url = formatDirectionsUrl(x.formatted_address, x.geometry.location.lat, x.geometry.location.lng, i)

@@ -134,5 +142,4 @@ console.log(

}
console.log('poop')
console.log('Showing ' + newArr.length + ' results.')
askSort(newArr)
console.log('Showing ' + newArr.length + ' results.\n')
setTimeout(()=>{askSort(newArr)}, 100)
} else {

@@ -181,4 +188,2 @@ console.log('No results found.\nPlease try to better specify your cravings.\n')

sorted.forEach(x=>console.log(x.closest))
sorted = nones.concat(sorted)

@@ -258,16 +263,2 @@

const muncher = () =>{
var P = [">:(#)", ">:|"];
var sandwich = ['######', '#####', '####', '###', '##', '#'];
var x = 0;
var y = 0;
console.log('\n')
return setInterval(() => {
process.stdout.clearLine();
process.stdout.write("\r" + P[x++] + sandwich[y++]);
x = x > 1 ? 0 : x;
y = y > 5 ? 0 : y;
}, 300);
};
const kirby = () =>{

@@ -274,0 +265,0 @@ var kirby = ["<(^o^)>", "<('o')>", "<('.'<)", "(>'.')>", "<('o')>" ];

{
"name": "foodie",
"version": "1.0.0",
"version": "1.0.1",
"description": "first foodie CLI",
"main": "index.js",
"bin": {
"foodie": "./index.js"
},
"scripts": {

@@ -11,3 +14,3 @@ "test": "foodie",

"config": {
"apiKey": "YOUR_API_KEY"
"apiKey1": "YOUR_API_KEY"
},

@@ -14,0 +17,0 @@ "author": "matt croak",

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