mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-24 07:39:36 +02:00
Linting
This commit is contained in:
parent
932a4aa0db
commit
f1d226e9c8
16 changed files with 20 additions and 19 deletions
|
@ -37,7 +37,7 @@ import {formatTravellers} from '../format/travellers.js';
|
||||||
import {formatLoyaltyCard} from '../format/loyalty-cards.js';
|
import {formatLoyaltyCard} from '../format/loyalty-cards.js';
|
||||||
import {formatTransfers} from '../format/transfers.js';
|
import {formatTransfers} from '../format/transfers.js';
|
||||||
|
|
||||||
const DEBUG = (/(^|,)hafas-client(,|$)/).test((typeof process !== 'undefined') ? (process.env.DEBUG || '') : '');
|
const DEBUG = (/(^|,)hafas-client(,|$)/).test(typeof process !== 'undefined' ? process.env.DEBUG || '' : '');
|
||||||
const logRequest = DEBUG
|
const logRequest = DEBUG
|
||||||
? (_, req, reqId) => console.error(String(req.body))
|
? (_, req, reqId) => console.error(String(req.body))
|
||||||
: () => { };
|
: () => { };
|
||||||
|
|
|
@ -7,9 +7,10 @@ const randomBytesHex = (nBytes = 8) => {
|
||||||
const array = new Uint8Array(nBytes);
|
const array = new Uint8Array(nBytes);
|
||||||
crypto.getRandomValues(array);
|
crypto.getRandomValues(array);
|
||||||
return Array.from(array)
|
return Array.from(array)
|
||||||
.map((byte) => byte.toString(16).padStart(2, '0'))
|
.map((byte) => byte.toString(16)
|
||||||
|
.padStart(2, '0'))
|
||||||
.join('');
|
.join('');
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkIfResponseIsOk = (_) => {
|
const checkIfResponseIsOk = (_) => {
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import dbnavBase from '../dbnav/base.json' with { type: "json" };
|
import dbnavBase from '../dbnav/base.json' with { type: 'json' };
|
||||||
import dbregioguideBase from '../dbregioguide/base.json' with { type: "json" };
|
import dbregioguideBase from '../dbregioguide/base.json' with { type: 'json' };
|
||||||
import {products} from '../../lib/products.js';
|
import {products} from '../../lib/products.js';
|
||||||
|
|
||||||
// journeys()
|
// journeys()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import baseProfile from './base.json' with { type: "json" };
|
import baseProfile from './base.json' with { type: 'json' };
|
||||||
import {products} from '../../lib/products.js';
|
import {products} from '../../lib/products.js';
|
||||||
import {formatJourneysReq, formatRefreshJourneyReq} from './journeys-req.js';
|
import {formatJourneysReq, formatRefreshJourneyReq} from './journeys-req.js';
|
||||||
import {formatTripReq} from './trip-req.js';
|
import {formatTripReq} from './trip-req.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import baseProfile from './base.json' with { type: "json" };
|
import baseProfile from './base.json' with { type: 'json' };
|
||||||
import {products} from '../../lib/products.js';
|
import {products} from '../../lib/products.js';
|
||||||
import {formatTripReq} from './trip-req.js';
|
import {formatTripReq} from './trip-req.js';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import baseProfile from './base.json' with { type: "json" };
|
import baseProfile from './base.json' with { type: 'json' };
|
||||||
import {products} from '../../lib/products.js';
|
import {products} from '../../lib/products.js';
|
||||||
import {formatJourneysReq, formatRefreshJourneyReq} from './journeys-req.js';
|
import {formatJourneysReq, formatRefreshJourneyReq} from './journeys-req.js';
|
||||||
import {formatLocationFilter} from './location-filter.js';
|
import {formatLocationFilter} from './location-filter.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbnav/index.js';
|
import {profile as rawProfile} from '../p/dbnav/index.js';
|
||||||
import res from './fixtures/dbnav-departures.json' with { type: "json" };
|
import res from './fixtures/dbnav-departures.json' with { type: 'json' };
|
||||||
import {dbnavDepartures as expected} from './fixtures/dbnav-departures.js';
|
import {dbnavDepartures as expected} from './fixtures/dbnav-departures.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -5,7 +5,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbnav/index.js';
|
import {profile as rawProfile} from '../p/dbnav/index.js';
|
||||||
import res from './fixtures/dbnav-refresh-journey.json' with { type: "json" };
|
import res from './fixtures/dbnav-refresh-journey.json' with { type: 'json' };
|
||||||
import {dbNavJourney as expected} from './fixtures/dbnav-refresh-journey.js';
|
import {dbNavJourney as expected} from './fixtures/dbnav-refresh-journey.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -5,7 +5,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbnav/index.js';
|
import {profile as rawProfile} from '../p/dbnav/index.js';
|
||||||
import res from './fixtures/dbnav-stop.json' with { type: "json" };
|
import res from './fixtures/dbnav-stop.json' with { type: 'json' };
|
||||||
import {dbnavDepartures as expected} from './fixtures/dbnav-stop.js';
|
import {dbnavDepartures as expected} from './fixtures/dbnav-stop.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbnav/index.js';
|
import {profile as rawProfile} from '../p/dbnav/index.js';
|
||||||
import res from './fixtures/dbnav-trip.json' with { type: "json" };
|
import res from './fixtures/dbnav-trip.json' with { type: 'json' };
|
||||||
import {dbTrip as expected} from './fixtures/dbnav-trip.js';
|
import {dbTrip as expected} from './fixtures/dbnav-trip.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbregioguide/index.js';
|
import {profile as rawProfile} from '../p/dbregioguide/index.js';
|
||||||
import res from './fixtures/dbregioguide-trip.json' with { type: "json" };
|
import res from './fixtures/dbregioguide-trip.json' with { type: 'json' };
|
||||||
import {dbTrip as expected} from './fixtures/dbregioguide-trip.js';
|
import {dbTrip as expected} from './fixtures/dbregioguide-trip.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbweb/index.js';
|
import {profile as rawProfile} from '../p/dbweb/index.js';
|
||||||
import res from './fixtures/dbris-arrivals.json' with { type: "json" };
|
import res from './fixtures/dbris-arrivals.json' with { type: 'json' };
|
||||||
import {dbArrivals as expected} from './fixtures/dbris-arrivals.js';
|
import {dbArrivals as expected} from './fixtures/dbris-arrivals.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbweb/index.js';
|
import {profile as rawProfile} from '../p/dbweb/index.js';
|
||||||
import res from './fixtures/dbweb-departures.json' with { type: "json" };
|
import res from './fixtures/dbweb-departures.json' with { type: 'json' };
|
||||||
import {dbwebDepartures as expected} from './fixtures/dbweb-departures.js';
|
import {dbwebDepartures as expected} from './fixtures/dbweb-departures.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: true});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: true});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbweb/index.js';
|
import {profile as rawProfile} from '../p/dbweb/index.js';
|
||||||
import res from './fixtures/dbweb-journey.json' with { type: "json" };
|
import res from './fixtures/dbweb-journey.json' with { type: 'json' };
|
||||||
import {dbwebJourney as expected} from './fixtures/dbweb-journey.js';
|
import {dbwebJourney as expected} from './fixtures/dbweb-journey.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbweb/index.js';
|
import {profile as rawProfile} from '../p/dbweb/index.js';
|
||||||
import res from './fixtures/dbweb-refresh-journey.json' with { type: "json" };
|
import res from './fixtures/dbweb-refresh-journey.json' with { type: 'json' };
|
||||||
import {dbJourney as expected} from './fixtures/dbweb-refresh-journey.js';
|
import {dbJourney as expected} from './fixtures/dbweb-refresh-journey.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import tap from 'tap';
|
||||||
|
|
||||||
import {createClient} from '../index.js';
|
import {createClient} from '../index.js';
|
||||||
import {profile as rawProfile} from '../p/dbweb/index.js';
|
import {profile as rawProfile} from '../p/dbweb/index.js';
|
||||||
import res from './fixtures/dbweb-trip.json' with { type: "json" };
|
import res from './fixtures/dbweb-trip.json' with { type: 'json' };
|
||||||
import {dbwebTrip as expected} from './fixtures/dbweb-trip.js';
|
import {dbwebTrip as expected} from './fixtures/dbweb-trip.js';
|
||||||
|
|
||||||
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
|
||||||
|
|
Loading…
Add table
Reference in a new issue