poke-trip-finder
v0.1.2
Published
"Find pokemon for all trips"
Downloads
2
Readme
How To Use This Package
Install poke-trip-finder
npm install poke-trip-finder --save
Load It
var pokeFinder = require("poke-trip-finder");
Example
var lazy = require("poke-trip-finder/node_modules/lazy.js");
// time_left: unit - minute
// loc: [longitude, latitude]
var tripSample1 = lazy(
[ { stop_id: '201016',
departure_time: '10:25:00',
arrival_time: '10:25:00',
trip_id: '209.TA.31-372-sj2-3.3.R',
loc: [151.206819546447,-33.8857961160684],
time_left: 4 },
{ stop_id: '2000193',
departure_time: '10:26:00',
arrival_time: '10:26:00',
trip_id: '209.TA.31-372-sj2-3.3.R',
loc: [151.207891415834,-33.8838673849627],
time_left: 4 },
{ stop_id: '200039',
departure_time: '10:27:00',
arrival_time: '10:27:00',
trip_id: '209.TA.31-372-sj2-3.3.R',
loc: [151.20741303814,-33.8824872249282],
time_left: 4 },
{ stop_id: '200819',
departure_time: '10:29:00',
arrival_time: '10:29:00',
trip_id: '209.TA.31-372-sj2-3.3.R',
loc: [151.203622874032,-33.8840583905823],
time_left: 4 } ])
.map(function (x) {
return {
tripId: x.trip_id,
stop_id: x.stop_id,
lat: x.loc[1],
long: x.loc[0],
timeLeft: x.time_left
};
}).toArray();
var pokemon_1_Detail = { id: 1, lat: -33.8824872249282, long: 151.20741303814 };
var pokemon_2_Detail = { id: 2, lat: -33.8824872249282, long: 151.20741303814 };
var pokemon_3_Detail = { id: 3, lat: -33.8824872249282, long: 151.20741303814 };
var pokemon_4_Detail = { id: 4, lat: -33.8857961160684, long: 151.206819546447 };
var pokemon_5_Detail = { id: 5, lat: -33.8857961160684, long: 151.206819546447 };
var pokemon_6_Detail = { id: 6, lat: -33.8857961160684, long: 151.206819546447 };
var pokemon_7_Detail = { id: 7, lat: -33.8857961160684, long: 151.206819546447 };
var trips = [tripSample1];
var pokemonDetails = [pokemon_1_Detail, pokemon_2_Detail, pokemon_3_Detail, pokemon_4_Detail, pokemon_5_Detail, pokemon_6_Detail, pokemon_7_Detail];
var tt = pokeFinder.getPokemonStats(pokemonDetails, trips);
console.log(tt);