npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

compare-itinerary

v1.0.3

Published

A module to compare an itinerary with an array of existing initeraries

Downloads

4

Readme

Polytech Paris-sud

compare-itinerary

version 1.0.1

A module to compare an itinerary with an array of itineraries.

Utility

This module allow you to give an itinerary, a stock of itinerary and a radius and see if there is already one existing itinerary that match your itinerary. You can modify the value of the radius in meter.

Since the version 1.0.2, you can also compare 2 place to see if the distance between them is smaller than a given distance.

Install

npm install compare-itinerary

Example to compare itinerary

// Import package
var compareItinerary = require("compare-itinerary")

const trajects = compareItinerary.getSameTrajects(itinerary, existingItinerary, radius);

console.log(trajects)

Input value example

var existingItinerary = [{id: 1, from: {lat: 10.434, lon: 20.214}, to: {lat: 20.454, lon: 40.455}},
			{id: 2, from: {lat: 15.455, lon: 20.346}, to: {lat: 30.112, lon: 35.069}},
			{id: 3, from: {lat: 16.316, lon: 19.245}, to: {lat: 10.367, lon: 20.985}},
			{id: 4, from: {lat: 14.346, lon: 20.119}, to: {lat: 29.026, lon: 34.399}}];
                        
var itinerary = {from: {lat: 10.434, lon: 20.214}, to: {lat: 20.454, lon: 40.455}}; 

var radius = 250; //the value in meters of the max distance betwin the base traject and the existing one.

Returned value

[
   {
      id: 1,
      from : {
         lat : 12.236,
         lon : 18.541
      },
      to : {
         lat : 35.354,
         lon : 17.544
      }
   },{
      id: 8,
      from : {
         lat : 12.333,
         lon : 18.005
      },
      to : {
         lat : 35.654,
         lon : 17.989
      }
   },
]

Example to compare place

// Import package
var compareItinerary = require("compare-itinerary")

const near = compareItinerary.isNear(placeOne, placeTwo, radius);

console.log(near)

Input value example

                        
var placeOne = {lat: 10.434, lon: 20.214}; 
var placeTwo = {lat: 10.459, lon: 20.194}; 

var radius = 500; //the value in meters of the max distance between the two place

Returned value

true