From 3e18f5d41518c1f8a13b7aaf7f66e8642844dc64 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 13 Jun 2018 20:25:56 +0200 Subject: [PATCH] gitignore lockfile, add & remove todos, minor changes --- .gitignore | 2 ++ docs/departures.md | 1 + docs/writing-a-profile.md | 2 +- index.js | 1 + parse/date-time.js | 2 -- parse/location.js | 2 -- parse/operator.js | 1 - parse/remark.js | 1 - readme.md | 2 +- test/lib/validators.js | 4 ++++ 10 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index d6fb75eb..e4ed3d2b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ Thumbs.db .nvm-version node_modules npm-debug.log + +package-lock.json diff --git a/docs/departures.md b/docs/departures.md index 1a16535a..25953889 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -23,6 +23,7 @@ With `opt`, you can override the default options, which look like this: ```js { + // todo: products when: new Date(), direction: null, // only show departures heading to this station duration: 10 // show departures for the next n minutes diff --git a/docs/writing-a-profile.md b/docs/writing-a-profile.md index 8d5e0236..288f7dd0 100644 --- a/docs/writing-a-profile.md +++ b/docs/writing-a-profile.md @@ -12,7 +12,7 @@ This guide is about writing such a profile. If you just want to use an already s ## 0. How do the profiles work? -A profile contains of three things: +A profile may consist of three things: - **mandatory details about the HAFAS endpoint** - `endpoint`: The protocol, host and path of the endpoint. diff --git a/index.js b/index.js index 4826e28d..cdd86fdc 100644 --- a/index.js +++ b/index.js @@ -333,6 +333,7 @@ const createClient = (profile, request = _request) => { opt = Object.assign({ results: 256, // maximum number of vehicles duration: 30, // compute frames for the next n seconds + // todo: what happens with `frames: 0`? frames: 3, // nr of frames to compute products: null, // optionally an object of booleans polylines: false // return a track shape for each vehicle? diff --git a/parse/date-time.js b/parse/date-time.js index 78635354..63ea681a 100644 --- a/parse/date-time.js +++ b/parse/date-time.js @@ -2,8 +2,6 @@ const {DateTime} = require('luxon') -const validDate = /^(\d{4})-(\d{2})-(\d{2})$/ - const parseDateTime = (profile, date, time) => { const pDate = [date.substr(-8, 4), date.substr(-4, 2), date.substr(-2, 2)] if (!pDate[0] || !pDate[1] || !pDate[2]) { diff --git a/parse/location.js b/parse/location.js index 44f34f5c..490d9ad2 100644 --- a/parse/location.js +++ b/parse/location.js @@ -5,8 +5,6 @@ const STATION = 'S' const ADDRESS = 'A' // todo: what is s.rRefL? -// todo: is passing in profile necessary? - // todo: [breaking] change to createParseLocation(profile, lines) => (l) => loc const parseLocation = (profile, l, lines) => { const res = {type: 'location'} diff --git a/parse/operator.js b/parse/operator.js index b3682199..372b525e 100644 --- a/parse/operator.js +++ b/parse/operator.js @@ -2,7 +2,6 @@ const slugg = require('slugg') -// todo: is passing in profile necessary? const parseOperator = (profile, a) => { return { type: 'operator', diff --git a/parse/remark.js b/parse/remark.js index 0b8c7a52..5b173391 100644 --- a/parse/remark.js +++ b/parse/remark.js @@ -1,6 +1,5 @@ 'use strict' -// todo: is passing in profile necessary? const parseRemark = (profile, r) => { return null // todo } diff --git a/readme.md b/readme.md index 70e885b1..2f1c5ab6 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ HAFAS endpoint | wrapper library | docs | example code | source code [Nahverkehrsverbund Schleswig-Holstein (NAH.SH)](https://de.wikipedia.org/wiki/Nahverkehrsverbund_Schleswig-Holstein) | [`nahsh-hafas`](https://github.com/juliuste/nahsh-hafas) | [docs](p/nahsh/readme.md) | [example code](p/nahsh/example.js) | [src](p/nahsh/index.js) [![npm version](https://img.shields.io/npm/v/hafas-client.svg)](https://www.npmjs.com/package/hafas-client) -[![build status](https://img.shields.io/travis/public-transport/hafas-client.svg)](https://travis-ci.org/public-transport/hafas-client) +[![build status](https://img.shields.io/travis/public-transport/hafas-client.svg?branch=master)](https://travis-ci.org/public-transport/hafas-client) ![ISC-licensed](https://img.shields.io/github/license/public-transport/hafas-client.svg) [![chat on gitter](https://badges.gitter.im/public-transport/Lobby.svg)](https://gitter.im/public-transport/Lobby) [![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst) diff --git a/test/lib/validators.js b/test/lib/validators.js index ec864a04..88ddcc9c 100644 --- a/test/lib/validators.js +++ b/test/lib/validators.js @@ -185,6 +185,8 @@ const createValidateJourneyLeg = (cfg) => { a.strictEqual(typeof leg.direction, 'string', msg) a.ok(leg.direction, name + '.direction must not be empty') } + + // todo: validate polyline } return validateJourneyLeg } @@ -277,6 +279,8 @@ const validateMovement = (val, m, name = 'movement') => { anyOf(['location', 'station'], val, f.destination, fName + '.destination') a.strictEqual(typeof f.t, 'number', fName + '.frames must be a number') } + + // todo: validate polyline } const validateMovements = (val, ms, name = 'movements') => {