@@ -146,11 +146,17 @@ module.exports = async () => {
146146 // Add flight numbers to array to check for duplicates
147147 flightNumbers . push ( baseFlightNumber + wikiIndex ) ;
148148
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+
149155 // Calculate launch site depending on wiki manifest
150156 let launchpadId ;
151157 let timezone ;
152158 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 ) ) {
154160 const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
155161 json : {
156162 query : {
@@ -165,7 +171,7 @@ module.exports = async () => {
165171 } ) ;
166172 launchpadId = launchpads . docs [ 0 ] . id ;
167173 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 ) ) {
169175 const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
170176 json : {
171177 query : {
@@ -180,7 +186,7 @@ module.exports = async () => {
180186 } ) ;
181187 launchpadId = launchpads . docs [ 0 ] . id ;
182188 timezone = launchpads . docs [ 0 ] . timezone ;
183- } else if ( launchpad === 'SLC-4E' ) {
189+ } else if ( slc4ePattern . test ( launchpad ) ) {
184190 const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
185191 json : {
186192 query : {
@@ -195,7 +201,7 @@ module.exports = async () => {
195201 } ) ;
196202 launchpadId = launchpads . docs [ 0 ] . id ;
197203 timezone = launchpads . docs [ 0 ] . timezone ;
198- } else if ( launchpad === 'BC' || launchpad === 'BC / LC-39A' || launchpad === 'BC / SLC-40' ) {
204+ } else if ( bcPattern . test ( launchpad ) ) {
199205 const launchpads = await got . post ( `${ SPACEX_API } /launchpads/query` , {
200206 json : {
201207 query : {
0 commit comments