This package has been deprecated

    Author message:

    WARNING: This package is unmaintained and might be broken. If you would like to maintain it, please contact mail@juliustens.eu

    db-train-numbers

    0.0.1 • Public • Published

    db-train-numbers

    Fetch DB long distance train numbers for a given time interval.

    npm version Build Status Greenkeeper badge dependency status license chat on gitter

    Installation

    npm install --save db-train-numbers

    Usage

    const trainNumbers = require('db-train-numbers')
     
    const start = new Date('2018-06-19T05:30:00')
    const end = new Date('2018-06-19T08:30:00')
     
    const opt = { // defaults
        interval: 10 // lookup train numbers every * minutes between start and end    
    }
     
    trainNumbers(start, end, opt)
    .then(console.log)
    .catch(console.error)

    Returns a Promise that will resolve in an array of train objects which looks as follows:

    [
        {
            train: "IC 11840",
            journeyRef: "84/326594/18/19/80",
            lastDeparture: "2018-06-19T03:21:00.000Z"
        },
        {
            train: "IC 528",
            journeyRef: "84/324965/18/19/80",
            lastDeparture: "2018-06-19T03:24:00.000Z"
        },
        {
            train: "EN 40467",
            journeyRef: "84/267796/18/19/80",
            lastDeparture: "2018-06-18T03:12:00.000Z"
        },
        {
            train: "IC 516",
            journeyRef: "84/257824/18/19/80",
            lastDeparture: "2018-06-19T03:24:00.000Z"
        },
        {
            train: "IC 3518",
            journeyRef: "84/252900/18/19/80",
            lastDeparture: "2018-06-19T03:33:00.000Z"
        },
        {
            train: "ICE 71",
            journeyRef: "84/215926/18/19/80",
            lastDeparture: "2018-06-19T03:18:00.000Z"
        },
        {
            train: "EC 7",
            journeyRef: "84/215818/18/19/80",
            lastDeparture: "2018-06-19T02:49:00.000Z"
        }
        // …
    ]

    Fetch further information for trains using the journeyRef attribute and the journeyLeg method provided by the db-hafas module.

    You can use the lastDeparture attribute with the db-wagenreihung module.

    Contributing

    If you found a bug or want to propose a feature, feel free to visit the issues page.

    Install

    npm i db-train-numbers

    DownloadsWeekly Downloads

    4

    Version

    0.0.1

    License

    ISC

    Unpacked Size

    5.45 kB

    Total Files

    4

    Last publish

    Collaborators

    • juliuste