ca-highway-conditions-parser

v3.0.2
A library that parses the highway conditions format into JSON
california highway parser dot

ca-highway-conditions-parser

Installation

$ npm install --save ca-highway-conditions-parser

Usage

Parsing

import parser from 'ca-highway-conditions-parser';

const input = `
SR 20
    [IN THE NORTHERN CALIFORNIA AREA]
    1-WAY CONTROLLED TRAFFIC FROM 5.5 MI EAST OF THE JCT OF SR 16 TO "E" ST
/IN WILLIAMS/ (COLUSA CO) - DUE TO FLOODING
`;

parser(input).then(
  (notices) => console.log(notices[20]),
  (error) => console.error(`Failed to parse input: ${error}`)
);

Output

{
    "20": {
        "type": "SR",
        "highway": "20",
        "notices": [
            {
                "title": "IN THE NORTHERN CALIFORNIA AREA",
                "messages": [
                    "1-WAY CONTROLLED TRAFFIC FROM 5.5 MI EAST OF THE JCT OF SR 16 TO \"E\" ST /IN WILLIAMS/ (COLUSA CO) - DUE TO FLOODING"
                ]
            }
        ]
    }
}
npm i ca-highway-conditions-parser

Metadata

  • MIT
  • Whatever
  • Cameron Hunter
  • released 2/25/2017

Downloads

Maintainers