Comparing version 1.0.6 to 1.0.7
21
cli.js
@@ -11,4 +11,4 @@ #!/usr/bin/env node | ||
var sortProps = [ | ||
{name: 'price_level', high: false, initial: false, text1: '(cheapest)', textOpts: ['(cheapest)', '(most expensive)']}, | ||
{name: 'closest', high: false, initial:false, text: ''}, | ||
{name: 'price', high: false, initial: false, text1: '(cheapest)', textOpts: ['(cheapest)', '(most expensive)']}, | ||
{name: 'distance', high: false, initial:false, text: ''}, | ||
{name: 'rating', high: true, initial: true, text: '(best)', textOpts: ['(best)', '(worst)']} | ||
@@ -107,6 +107,6 @@ ] | ||
var distA = haversine(here, thereA); | ||
x['closest'] = distA | ||
x['distance'] = distA | ||
}) | ||
clearInterval(interval) | ||
mySort(data, 'closest') | ||
mySort(data, 'distance') | ||
}).catch((err)=> { | ||
@@ -129,3 +129,3 @@ console.log('Error: ' + err) | ||
var price = !x.price_level || x.price_level === 0 ? 'No Price' : ''; | ||
var distance = Math.max( Math.round(x.closest * 10) / 10).toFixed(2) + ' miles away' | ||
var distance = Math.max( Math.round(x.distance * 10) / 10).toFixed(2) + ' miles away' | ||
for (var y = 0; y < x.price_level; ++y) { | ||
@@ -163,3 +163,3 @@ price += '$' | ||
if (input === 'price_level'){ | ||
if (input === 'price'){ | ||
nones = newArr.filter(x=>!x.price_level || x.price_level === 0) | ||
@@ -173,4 +173,5 @@ sorts = newArr.filter(x=>x.price_level > 0) | ||
var sorted = sorts.sort((a, b)=>{ | ||
var sorter = input === 'price' ? "price_level" : input | ||
if (prop.high){ | ||
if (a[input] < b[input]){ | ||
if (a[sorter] < b[sorter]){ | ||
return -1 | ||
@@ -181,3 +182,3 @@ } else { | ||
} else { | ||
if (a[input] > b[input]){ | ||
if (a[sorter] > b[sorter]){ | ||
return -1 | ||
@@ -193,3 +194,3 @@ } else { | ||
prop.high = input !== 'closest' ? !prop.high : prop.high | ||
prop.high = input !== 'distance' ? !prop.high : prop.high | ||
//reset other setProps values back to original high value | ||
@@ -207,3 +208,3 @@ sortProps.forEach(x=>{ | ||
var props = sortProps.map((prop, i)=>{ | ||
if (prop.name !== 'closest'){ | ||
if (prop.name !== 'distance'){ | ||
prop.text = prop.initial === prop.high ? prop.textOpts[0] : prop.textOpts[1] | ||
@@ -210,0 +211,0 @@ } |
{ | ||
"name": "foodie", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Foodie is the most delicious command line interface out there. Type in what you want to eat and let foodie find restuarants nearby to satisfy your cravings.", | ||
@@ -5,0 +5,0 @@ "main": "cli.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
208197
5
243
64