Skip to content

Commit

Permalink
switch to eslint, update dependencies, fix readme examples, remove tr…
Browse files Browse the repository at this point in the history
…avis, add github action
  • Loading branch information
linusnorton committed Sep 15, 2023
1 parent a2d5f38 commit 1480878
Show file tree
Hide file tree
Showing 16 changed files with 1,590 additions and 411 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-prototype-builtins": "off"
}
}
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
version: ['14', '16', '18', '20']
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
cache: npm
- run: npm install
- run: npm test

7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Raptor Journey Planner
=========================
[![Travis](https://img.shields.io/travis/planarnetwork/raptor.svg?style=flat-square)](https://travis-ci.org/planarnetwork/raptor) ![npm](https://img.shields.io/npm/v/raptor-journey-planner.svg?style=flat-square) ![David](https://img.shields.io/david/planarnetwork/raptor.svg?style=flat-square)
![npm](https://img.shields.io/npm/v/raptor-journey-planner.svg?style=flat-square)

A near direct implementation of the [Round bAsed Public Transit Optimized Router (Raptor)](https://www.microsoft.com/en-us/research/wp-content/uploads/2012/01/raptor_alenex.pdf) journey planning algorithm as described in the paper.

Expand All @@ -19,9 +19,9 @@ Additional features not in the paper implementation:

## Usage

It will work with any well formed GTFS data set.
It will work with any well-formed GTFS data set.

Node +11 is required for all examples.
Node +14 is required for all examples.

```
npm install --save raptor-journey-planner
Expand All @@ -32,7 +32,7 @@ npm install --save raptor-journey-planner
Find the first results that depart after a specific time

```
const fs = require("FS");
const fs = require("fs");
const {loadGTFS, JourneyFactory, RaptorAlgorithmFactory, DepartAfterQuery} = require("raptor-journey-planner");
const [trips, transfers, interchange, calendars] = await loadGTFS(fs.createReadStream("gtfs.zip"));
Expand All @@ -47,9 +47,10 @@ const journeys = query.plan("NRW", "STA", new Date(), 9 * 60 * 60);
Find results from multiple origin and destinations

```
const fs = require("fs");
const {loadGTFS, JourneyFactory, RaptorAlgorithmFactory, GroupStationDepartAfterQuery} = require("raptor-journey-planner");
const [trips, transfers, interchange, calendars] = await loadGTFS("gtfs.zip");
const [trips, transfers, interchange, calendars] = await loadGTFS(fs.createReadStream("gtfs.zip"));
const raptor = RaptorAlgorithmFactory.create(trips, transfers, interchange, calendars);
const resultsFactory = new JourneyFactory();
const query = new GroupStationDepartAfterQuery(raptor, resultsFactory);
Expand All @@ -61,9 +62,10 @@ const journeys = query.plan(["NRW"], ["LST", "EUS"], new Date(), 9 * 60 * 60);
Find results departing between a time range

```
const fs = require("fs");
const {loadGTFS, JourneyFactory, RaptorAlgorithmFactory, RangeQuery} = require("raptor-journey-planner");
const [trips, transfers, interchange, calendars] = await loadGTFS("gtfs.zip");
const [trips, transfers, interchange, calendars] = await loadGTFS(fs.createReadStream("gtfs.zip"));
const raptor = RaptorAlgorithmFactory.create(trips, transfers, interchange, calendars);
const resultsFactory = new JourneyFactory();
const query = new RangeQuery(raptor, resultsFactory);
Expand All @@ -75,9 +77,10 @@ const journeys = query.plan("NRW", "LST", new Date(), 9 * 60 * 60, 11 * 60 * 60)
Finds transfer patterns for a stop on a given date

```
const fs = require("fs");
const {loadGTFS, StringResults, RaptorAlgorithmFactory, TransferPatternQuery} = require("raptor-journey-planner");
const [trips, transfers, interchange, calendars] = await loadGTFS("gtfs.zip");
const [trips, transfers, interchange, calendars] = await loadGTFS(fs.createReadStream("gtfs.zip"));
const raptor = RaptorAlgorithmFactory.create(trips, transfers, interchange, calendars);
const resultsFactory = () => new StringResults();
const query = new TransferPatternQuery(raptor, resultsFactory);
Expand All @@ -89,9 +92,10 @@ const journeys = query.plan("NRW", new Date());
By default the multi-criteria filter will keep journeys as long as there are no subsequent journeys that arrive sooner and have the same or less changes.

```
const fs = require("fs");
const {loadGTFS, JourneyFactory, RaptorAlgorithmFactory, RangeQuery, MultipleCriteriaFilter} = require("raptor-journey-planner");
const [trips, transfers, interchange, calendars] = await loadGTFS("gtfs.zip");
const [trips, transfers, interchange, calendars] = await loadGTFS(fs.createReadStream("gtfs.zip"));
const raptor = RaptorAlgorithmFactory.create(trips, transfers, interchange, calendars);
const resultsFactory = new JourneyFactory();
const filter = new MultipleCriteriaFilter();
Expand Down
Loading

0 comments on commit 1480878

Please sign in to comment.