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

uk-traffic

v3.0.2

Published

A Node module to provide access to UK traffic information

Downloads

8

Readme

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