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

wmata-metro-js

v1.2.3

Published

Metro api for node.js

Downloads

20

Readme

node-wmata-metro

Build Status

Looking for bus?

Check out this

Install

$ npm install wmata-metro-js --save

Get started

  1. Grab your metro API key
  2. Init the client

var Metro = require('metro');
var client = new Metro('api key here');

Examples


var Metro = require('wmata-metro-js');
var client = new Metro(process.env.METROPASSWORD);

// second param for sorting into separate stations
client.getRailStationPrediction('A10,C12', true, function(err, res) {
  if (err) throw err;
  else console.log(res);
});

client.getRailStationToStationInfo('A10', 'C12', function(err, res) {
  if (err) throw err;
  else console.log(res);
});

API

getRailLines(done)

Get all rail lines

Parameters

done: function, callback(err, res)

Returns: Array, - list of lines with codes

getRailStations(lineCode, done)

For a given line, get all stations

Parameters

lineCode: String, the line code, ie: RD or SV

done: function, callback(err, res)

Returns: Array, - list of stations for a given line

getRailStationInfo(stationCode, done)

Get info for a station

Parameters

stationCode: String, a station code, ie: A10

done: function, callback(err, res)

Returns: Object, - object of properties corresponding to station

getRailPaths(fromStationCode, toStationCode, done)

Get stations between two different stations

Parameters

fromStationCode: String, start station code, ie: A10

toStationCode: String, end station code, ie: C03

done: function, callback(err, res)

Returns: Array, - list of stations between a start and end station

getRailStationPrediction(stationCodes, done)

Get prediction times for a station

Parameters

stationCodes: String, station code, ie: A10. Can also include a multiple stations separated by comma, ie:A10,A11,C02.

done: function, callback(err, res)

Returns: Array, - list of train predictions

getRailStationEntrances(loc, radius, done)

Get station entrance info via a location

Parameters

loc: Object, object of coordinates, ie: loc.lat, loc.lon

radius: Number, radius of search location in meters

done: function, callback(err, res)

Returns: Array, - list of meta info on the stations that are near the loc

getRailStationParking(stationCode, done)

Get rail station parking info

Parameters

stationCode: String, station code, ie: A10

done: function, callback(err, res)

Returns: Array, - list of parking info on the station

getRailStationTimes(stationCode, done)

Get rail station time info

Parameters

stationCode: String, station code, ie: A10

done: function, callback(err, res)

Returns: Array, - list of time info on the station

getRailStationToStationInfo(fromStationCode, toStationCode, done)

Get rail station to station info

Parameters

fromStationCode: String, start station code, ie: A10

toStationCode: String, end station code, ie: B05

done: function, callback(err, res)

Returns: Array, - list of station to station info on the stations

getClosestStationsPrediction(loc, radius, limit, done)

Get the closest stations and their predictions given a location

Parameters

loc: Object, the coordinates for a point to search, loc.lat, loc.lon

radius: Number, the search radius in meters

limit: Number, the number of of stations to return

done: function, callback(err, res)

Returns: Array, - list of stations closest to your coordinate and their predictions