@@ -245,22 +245,18 @@ const possibleTargets: Record<string, Record<string, string[]>> = {};
245245
246246for ( const converterName in properties ) {
247247 const converterProperties = properties [ converterName ] ?. properties ;
248-
249- if ( ! converterProperties ) {
250- continue ;
251- }
248+ if ( ! converterProperties ) continue ;
252249
253250 for ( const key in converterProperties . from ) {
254- if ( converterProperties . from [ key ] === undefined ) {
255- continue ;
256- }
251+ const fromList = converterProperties . from [ key ] ;
252+ const toList = converterProperties . to [ key ] ;
257253
258- for ( const extension of converterProperties . from [ key ] ?? [ ] ) {
259- if ( ! possibleTargets [ extension ] ) {
260- possibleTargets [ extension ] = { } ;
261- }
254+ if ( ! fromList || ! toList ) continue ;
255+
256+ for ( const ext of fromList ) {
257+ if ( ! possibleTargets [ ext ] ) possibleTargets [ ext ] = { } ;
262258
263- possibleTargets [ extension ] [ converterName ] = converterProperties . to [ key ] || [ ] ;
259+ possibleTargets [ ext ] [ converterName ] = toList ;
264260 }
265261 }
266262}
@@ -289,11 +285,6 @@ for (const converterName in properties) {
289285}
290286possibleInputs . sort ( ) ;
291287
292- // eslint-disable-next-line @typescript-eslint/no-unused-vars
293- const getPossibleInputs = ( ) => {
294- return possibleInputs ;
295- } ;
296-
297288const allTargets : Record < string , string [ ] > = { } ;
298289
299290for ( const converterName in properties ) {
@@ -336,29 +327,3 @@ for (const converterName in properties) {
336327export const getAllInputs = ( converter : string ) => {
337328 return allInputs [ converter ] || [ ] ;
338329} ;
339-
340- // // count the number of unique formats
341- // const uniqueFormats = new Set();
342-
343- // for (const converterName in properties) {
344- // const converterProperties = properties[converterName]?.properties;
345-
346- // if (!converterProperties) {
347- // continue;
348- // }
349-
350- // for (const key in converterProperties.from) {
351- // for (const extension of converterProperties.from[key] ?? []) {
352- // uniqueFormats.add(extension);
353- // }
354- // }
355-
356- // for (const key in converterProperties.to) {
357- // for (const extension of converterProperties.to[key] ?? []) {
358- // uniqueFormats.add(extension);
359- // }
360- // }
361- // }
362-
363- // // print the number of unique Inputs and Outputs
364- // console.log(`Unique Formats: ${uniqueFormats.size}`);
0 commit comments