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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pathfinder.js

v1.0.2

Published

The Pathfinder JS SDK allows developers to integrate with the Pathfinder routing service

Readme

pathfinder.js - A JavaScript SDK for web clients.

The Pathfinder JS Client Library allows developers to easily integrate Pathfinder routing service in their web applications.

Pathfinder provides routing as a service, removing the need for developers to implement their own routing logistics. This SDK allows for iOS applications to act as commodities that need transportation or vehicles that provide transportation. Additionally, there is support for viewing routes for sets of commodities and vehicles.

Publicly Hosted Documentation

Building the Library and Documentation

  1. Install Node dependencies with
$ npm install
  1. Run gulp
$ gulp

Gulp will watch source files and re-minify if one is modified

Using Pathfinder.js

Before you can use pathfinder, you will need to include it in your website:

<script type="text/javascript" src="js/vendor/pathfinder.min.js"></script>

To start using pathfinder, create a pathfinder object using your app id and user credentials. Both the app id and user credentials can be found on the web portal.

var myAppId = 'xyz';
var userCreds = fetchUserCreds();
var pathfinderRef = new Pathfinder(myAppId, userCreds);

Once you have a pathfinder object, you can interact with your data in one of two ways:

  1. As an observer
  2. As a commodity transport requester

As an observer

If your application wants to display data regarding all (or some subset of) commodities, vehicles and their routes for a cluster, you will want to do the following:

  1. Obtain a cluster reference from the pathfinder object
pathfinderRef.defaultCluster(function(c) {
  cluster = c;
});
  1. Set callback functions to be notified whenever new commodities or vehicles appear, when vehicles move, when commodities are picked up, dropped off or cancelled and when routes are generated.
cluster.vehicleDidComeOnline(function(vehicle) {
  // Handle new vehicle
});

See the api documentation for a complete list of available callbacks

As a commodity transport requester

If your application requests commodities, you will want to do the following:

  1. Determine the physical parameters that your commodity takes up. These parameters should match the constraints that are placed on the vehicles in the same cluster. Any parameters that are not set will be assumed to be zero.
var parameters = {
  "people": 2
};
  1. Initiate the request and obtain a commodity reference from the top-level pathfinder object.
pathfinder.requestCommodityTransit(cluster, startCoordinates, endCoordinates, parameters, function(c) {
  commodity = c;
});
  1. Set callbacks on the commodity to be notified when it is assigned to a route or its pickup/dropoff/cancel status changes.
commodity.wasRouted(function(route) {
  // e.g. Render route on map
});

See the api documentation for a complete list of available callbacks