@transportme/vline-nsp-reader 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { getOperationDays } from './nsp-utils.mjs'
2
2
  import TableReader from './table-reader.mjs'
3
+ import termini from './termini.mjs'
3
4
 
4
5
  export default class NSPPDFReader {
5
6
 
@@ -138,6 +139,12 @@ export default class NSPPDFReader {
138
139
  runData.stations = runData.stations.map(station => this.processStation(station))
139
140
  let forming = body[stations.length - 1][runIndex].toUpperCase()
140
141
  runData.forming = forming.length ? forming : null
142
+
143
+ let origin = runData.stations[0].name.toUpperCase()
144
+ let destination = runData.stations[runData.stations.length - 1].name.toUpperCase()
145
+
146
+ runData.routeName = termini[`${origin}-${destination}`] || termini[origin] || termini[destination] || 'Other'
147
+
141
148
  runs.push(runData)
142
149
  }
143
150
 
@@ -1,4 +1,4 @@
1
- import PDFParser from 'pdf2json'
1
+ import PDFParser from '@transportme/pdf2json'
2
2
  import fs from 'fs/promises'
3
3
 
4
4
  export default class TableReader {
@@ -0,0 +1,43 @@
1
+ export default {
2
+ ALBURY: 'Albury',
3
+ WODONGA: 'Albury',
4
+ WANGARATTA: 'Albury',
5
+
6
+ ARARAT: 'Ararat',
7
+
8
+ BAIRNSDALE: 'Bairnsdale',
9
+ SALE: 'Bairnsdale',
10
+
11
+ BENDIGO: 'Bendigo',
12
+ CASTLEMAINE: 'Bendigo',
13
+ EAGLEHAWK: 'Bendigo',
14
+ EPSOM: 'Bendigo',
15
+ KYNETON: 'Bendigo',
16
+
17
+ 'BACCHUS MARSH': 'Ballarat',
18
+ BALLARAT: 'Ballarat',
19
+ WENDOUREE: 'Ballarat',
20
+ MELTON: 'Ballarat',
21
+
22
+ ECHUCA: 'Echuca',
23
+
24
+ GEELONG: 'Geelong',
25
+ MARSHALL: 'Geelong',
26
+ 'SOUTH GEELONG': 'Geelong',
27
+ 'WAURN PONDS': 'Geelong',
28
+ 'WYNDHAM VALE': 'Geelong',
29
+
30
+ MARYBOROUGH: 'Maryborough',
31
+ 'MARYBOROUGH-BALLARAT': 'Maryborough',
32
+ 'BALLARAT-MARYBOROUGH': 'Maryborough',
33
+
34
+ SEYMOUR: 'Seymour',
35
+ SHEPPARTON: 'Shepparton',
36
+
37
+ 'SWAN HILL': 'Swan Hill',
38
+ 'SWAN HILL-BENDIGO': 'Swan Hill',
39
+
40
+ TRARALGON: 'Traralgon',
41
+
42
+ WARRNAMBOOL: 'Warrnambool'
43
+ }
package/lib/vline-nsp.mjs CHANGED
@@ -92,5 +92,5 @@ export async function getNSPVersion() {
92
92
  nspVersion.addFile(new NSPFile(name.replace(/ NSP.+/, '').trim(), $(button).attr('href'), nspVersion))
93
93
  })
94
94
 
95
- return Object.values(nspVersions).sort((a, b) => b.effective - a.effective)
95
+ return Object.values(nspVersions).sort((a, b) => b.effective - a.effective).filter(version => version.files.length > 5)
96
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/vline-nsp-reader",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "main": "lib.mjs",
5
5
  "scripts": {
6
6
  "test": "mocha"
@@ -9,10 +9,10 @@
9
9
  "license": "ISC",
10
10
  "description": "",
11
11
  "dependencies": {
12
+ "@transportme/pdf2json": "^4.0.10000002",
12
13
  "async": "^3.2.6",
13
14
  "cheerio": "^1.0.0",
14
- "node-fetch": "^3.3.2",
15
- "pdf2json": "github:eyeballcode/pdf2json"
15
+ "node-fetch": "^3.3.2"
16
16
  },
17
17
  "devDependencies": {
18
18
  "chai": "^5.1.2",