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

travelord

v0.1.0

Published

CLI tool and typescript library for ranking points of interest along a path of travel

Downloads

11

Readme

travelord

Travelord is a simple library written in Typescript that provides functions for ranking points of interest along a path of travel. It offers both a library interface for programmatic use and a command-line interface (CLI) for easy integration into your projects.

This library is almost entirely written using ChatGPT. including this README!

Features

  • Rank points along a bearing line based on their distance and bearing difference.
  • Filter points based on a bearing difference threshold.
  • Sort points based on distance and bearing difference.
  • access to underlying functions

Why?

I wanted to plan my travel by train across europe, hitting up as many slacklining/highlining communities along the way using data from SlackMap: https://slackmap.com/communities

This tool is useful for anyone who needs to plan a route given a list of POIs that they would like to visit along the way.

Documentation

This library is super simple, all the functions contain JSDoc comments and are well typed.

Installation

To install Travelord, use pnpm, npm or yarn:

npm install travelord

CLI Usage

travelord --input data.json --output output.json

CLI Options

--start: The start coordinate in the format lat,lng.
--end: The end coordinate in the format lat,lng.
--input: The input JSON file containing the array of points.
--output: The output JSON file to save the sorted points (specify the input file to overwrite). If not provided, the output goes to STDOUT.

Use travelord --help to get a full description

Library Usage

Here's an example of how to use My Package in your JavaScript/TypeScript code:

import { rankPointsAlongBearing } from "travelord";

// Define your start and end coordinates
const start = { lat: 0, lng: 0 };
const end = { lat: 10, lng: 10 };

// Define an array of points
const points = [
    { lat: 2, lng: 2 },
    { lat: 5, lng: 5 },
    { lat: 8, lng: 8 },
];

// Rank the points along the bearing line
const rankedPoints = rankPointsAlongBearing(start, end, points);

console.log(rankedPoints);

Contributing

Contributions are welcome! Please feel free to submit a PR or message me if you need help

Possible improvements

  • fix lint precommit hook

  • implement automated tagged releases and publish to npm

  • use a dictionary of coordinates and/or google api to accept city names instead of coordinates

  • improve the ranking algorithm or give it more options

  • add support for an iterative ranking process

  • validate the CLI input data

  • add csv support

  • add examples in docs

License

This project is licensed under the MIT License.