3.0.2 • Published 3 years ago

uk-traffic v3.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

traffic

npm version Node.js CI

A Node module to provide access to UK traffic information

Prerequisities

Node 12.x

Installation

npm install uk-traffic --save

API

First you must obtain a reference to the module:

const traffic = require('uk-traffic')

Examples

There are some example uses of the library in the examples/ directory

Properties

Incidents

traffic.incidents(region: REGION?) : Promise

Takes a region, returns a promise containing an array of events.

Roadworks

traffic.roadworks(region: REGION?) : Promise

Takes a region, returns a promise containing an array of events.

Data Types

Region

A Region is an enum representing a region which can be used to narrow down results; you should use traffic.Region to get a valid region (e.g. traffic.Region.NORTH_WEST). The available regions are:

SOUTH_EAST
SOUTH_WEST
EASTERN
WEST_MIDLANDS
EAST_MIDLANDS
NORTH_WEST
NORTH_EAST

Event

An Event is the standard data type returned by the module for all functions. See below for an example; all keys will be present, but they may have undefined or null values.

{
  title: "M25 J25 clockwise access",
  category: "Road Works",
  delay: "Severe Disruption - in excess of 3 hours delay or road closure",
  link: "https://www.mycooltrafficsite.com/1234",
  timing: {
    start: "2020-07-07T21:00:00+01:00",
    end: "2020-07-08T05:00:00+01:00"
  },
  location: {
    road: "M25",
    county: "Greater London Authority",
    region: "Eastern",
    latitude: 51.68319,
    longitude: -0.04578481
  }
}

Debugging

You can enable additional debug logging by setting the environment variable DEBUG=uk-traffic

3.0.2

3 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago

0.10.0

5 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.0

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago