Socket
Socket
Sign inDemoInstall

bay-area-rapid-transit

Package Overview
Dependencies
5
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bay-area-rapid-transit

A small JavaScript wrapper around the [BART XML API](http://api.bart.gov/docs/overview/index.aspx). Works in web browsers and Node.js.


Version published
Maintainers
1
Install size
419 kB
Created

Readme

Source

bart

A small JavaScript wrapper around the BART XML API. Works in web browsers and Node.js.

Installation & Usage

The name bart was taken, so...

npm install --save bay-area-rapid-transit

Basic usage
const Bart = require("bay-area-rapid-transit")
const client = new Bart("MY_API_KEY")
Configuring fetch

When using this module in Node.js, you must either provide a global fetch that is compatible with the Fetch API, or pass a fetch function to the client at initialization time.

const { fetch } = require("fetch-ponyfill")() // https://github.com/qubyte/fetch-ponyfill
const Bart = require("bay-area-rapid-transit")
const client = new Bart({ key: "MY_API_KEY", fetch })

Alternately, you can call methods directly on the Bart object if you provide the API key as key in params. Each method takes an object of params as the first argument and an optional callback as the second. If no callback is provided, a promise is returned.

Supports the following methods, which map directly to the BART API endpoints:

  • advisories
  • trainCount
  • elevatorInformation
  • realTimeEstimates
  • routes
  • routesInformation
  • quickPlannerArrive
  • quickPlannerDepart
  • fare
  • holidays
  • loadFactor
  • routeSchedule
  • availableSchedules
  • specialSchedules
  • stationSchedule
  • stationList
  • stationInformation
  • stationAccessInformation

test/index.js has integration tests for each method and schemas against which the responses are validated. More documentation may eventually be added to this readme but the test file should suffice for most uses.

FAQs

Last updated on 31 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc