@@ -146,11 +146,17 @@ module.exports = async () => {
146
146
// Add flight numbers to array to check for duplicates
147
147
flightNumbers . push ( baseFlightNumber + wikiIndex ) ;
148
148
149
+ // Wiki launchpad matchers
150
+ const slc40Pattern = / ^ .* S L C - 4 0 .* L C - 3 9 A | B C ? .* $ / i;
151
+ const lc39aPattern = / ^ .* L C - 3 9 A .* S L C - 4 0 | B C ? .* $ / i;
152
+ const slc4ePattern = / ^ .* S L C - 4 E .* $ / i;
153
+ const bcPattern = / ^ .* B C .* S L C - 4 0 | L C - 3 9 A ? .* $ / i;
154
+
149
155
// Calculate launch site depending on wiki manifest
150
156
let launchpadId ;
151
157
let timezone ;
152
158
const launchpad = wikiLaunchpads [ parseInt ( wikiIndex , 10 ) ] ;
153
- if ( launchpad === 'SLC-40' || launchpad === 'SLC-40 / LC-39A' || launchpad === 'SLC-40 / BC' || launchpad === 'SLC-40, LC-39A' ) {
159
+ if ( slc40Pattern . test ( launchpad ) ) {
154
160
const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
155
161
json : {
156
162
query : {
@@ -165,7 +171,7 @@ module.exports = async () => {
165
171
} ) ;
166
172
launchpadId = launchpads . docs [ 0 ] . id ;
167
173
timezone = launchpads . docs [ 0 ] . timezone ;
168
- } else if ( launchpad === 'LC-39A' || launchpad === 'LC-39A / BC' || launchpad === 'LC-39A / SLC-40' ) {
174
+ } else if ( lc39aPattern . test ( launchpad ) ) {
169
175
const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
170
176
json : {
171
177
query : {
@@ -180,7 +186,7 @@ module.exports = async () => {
180
186
} ) ;
181
187
launchpadId = launchpads . docs [ 0 ] . id ;
182
188
timezone = launchpads . docs [ 0 ] . timezone ;
183
- } else if ( launchpad === 'SLC-4E' ) {
189
+ } else if ( slc4ePattern . test ( launchpad ) ) {
184
190
const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
185
191
json : {
186
192
query : {
@@ -195,7 +201,7 @@ module.exports = async () => {
195
201
} ) ;
196
202
launchpadId = launchpads . docs [ 0 ] . id ;
197
203
timezone = launchpads . docs [ 0 ] . timezone ;
198
- } else if ( launchpad === 'BC' || launchpad === 'BC / LC-39A' || launchpad === 'BC / SLC-40' ) {
204
+ } else if ( bcPattern . test ( launchpad ) ) {
199
205
const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
200
206
json : {
201
207
query : {
0 commit comments