mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-12-20 21:20:50 +01:00
| .. | ||
| CHANGELOG.md | ||
| index.js | ||
| LICENSE-AGPL.txt | ||
| LICENSE-EUPL.txt | ||
| package.json | ||
| README.md | ||
| test.js | ||
@digitransit-util/digitransit-util-enrich-patterns
enrichPatterns
Parameters
patternsobject Array of patterns (result from GraphiQL query)onlyInFutureboolean Is filtered out today's past tripsserviceTimeRangenumber How many days shows in UI
Examples
digitransit-util.enrichPatterns([ { code: 'HSL:3002U:0:02', headsign: 'Kirkkonummi', stops: [{ name: 'Helsinki' }, { name: 'Kirkkonummi' }], tripsForDate: [], activeDates: [{ "day": [ "20200329" ] },{ "day": [ "20200329" ] },{ "day": [ "20200329" ] }, { "day": [ "20200329" ] }] } ], true, 30);
//=[ { code: 'HSL:3002U:0:02', headsign: 'Kirkkonummi', stops: [{ name: 'Helsinki' }, { name: 'Kirkkonummi' }], tripsForDate: [], activeDates: ["20200221","20200222","20200228","20200229"], } ]
Returns Object enriched pattern
This module is part of the Digitransit-ui project. It is maintained in the HSLdevcom/digitransit-ui repository, where you can create PRs and issues.
Installation
Install this module individually:
$ npm install @digitransit-util/digitransit-util-enrich-patterns
Or install the Digitransit-util module that includes it as a function:
$ npm install @digitransit-util/digitransit-util