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

mta-metro

v2.0.2

Published

New York MTA Metro Rail Roads real time data API Library

Downloads

24

Readme

MTA-metro 🚇

NPM

Build Status NPM Version Licence Made NYC

MTA-metro is a wrapper for New York MTA Rail Roads real time data API.

The API´s included are:

  1. Metro North
  2. Long Island (LIRR)
  3. ~~Subway~~ (Future dev)

Installation

This is a Node.js module available through the npm registry.

npm install mta-metro --save

Quick Start

In order to use the MTA real-time APIs, you will need an MTA API key from here: http://datamine.mta.info/user/register

First, create a mtaMetro object with your API key.

const mm = require('mta-metro')
var mta = new mm.mtaMetro('<YOU-API-KEY>')

MTA terms of agreement

Please ensure of reading MTA rules & guidelines: http://datamine.mta.info/usage-rules-and-guidelines

I am not responsible of any misuse of this package that could lead to a violation of the terms of agreements stated by the MTA.

Line service status

Get the status of of any line from (MetroNorth or LIRR) or if left blank you will get the status of ALL the lines of this services.

	var lines = [mm.dic.MN.LINES.HUDSON,mm.dic.MN.LINES.NEWHAVEN,mm.dic.LIRR.LINES.MONTAUK];
	mta.status(lines).then(function(result) {
	    console.log(result)
	}).catch(function (err) {
	    console.log(err)
	});

Schedule

Get real time schedule data from (MetroNorth & LIRR) given a single origin object and a destiny object.

	let options = {
    	from: mm.dic.MN.STATIONS.GRANDCENTRAL, //station obj
    	to: mm.dic.MN.STATIONS.BEACON, //station obj
	    day:"YYYY-MM-DD", //optional if not provided it will use current
	    time:"HH:MM", //optional if not provided it will use current
	}
	mta.schedule(options).then(function(result) {
	    console.log(result)
	}).catch(function (err) {
	    console.log(err)
	});

The result of this call will be a JSON object with all the details of the Schedule from the time requested.

For more examples please review the file test/test.js and for information on the Stations of Metro-North, LIRR or Subway visit: http://datamine.mta.info/list-of-feeds

ToDo

  • Create and Implement wrapper for NYC subway.
  • Enable Subway status
  • Improve schedule results, at the moment it only show times up to the end of the day in question.

Updates

  • Added: MTA Dictionary , so you don´t have to learn the Metro-North or LIRR Lines and Stations, you can just start typing and you will get the object.
  • Colors property can also be found by line.

Ex.

const mm = require('mta-metro')
var lines = [mm.dic.MN.LINES.HUDSON,mm.dic.LIRR.LINES.MONTAUK];
var stations = [mm.dic.MN.STATIONS.GRANDCENTRAL, mm.dic.MN.STATIONS.YANKEESE153ST , mm.dic.LIRR.STATIONS.OYSTERBAY]
var lineColor = mm.dic.MN.LINES.HUDSON.color
  • Added: Chai unit tests for CI
  • Added: Travis CI
  • Improved: Faster use of the corresponding service Object (MN, LIRR)
  • Removed: The need of adding the Service name ("MN" or "LIRR" ) when using the schedule promise.

License

MIT