@@ -48,7 +48,7 @@ export * as Translation from './translation';
4848// UTILITY FUNCTIONS
4949// ===================================================================
5050
51- import { BaseProcessor } from './core/baseProcessor' ;
51+ import { BaseProcessor , ProcessorOptions } from './core/baseProcessor' ;
5252import { DotProcessor } from './processors/dotProcessor' ;
5353import { ExcelProcessor } from './processors/excelProcessor' ;
5454import { OpmlProcessor } from './processors/opmlProcessor' ;
@@ -70,36 +70,39 @@ import { ObfsetProcessor } from './processors/obfsetProcessor';
7070 * const processor = getProcessor('/path/to/file.gridset');
7171 * const tree = processor.loadIntoTree('/path/to/file.gridset');
7272 */
73- export function getProcessor ( filePathOrExtension : string ) : BaseProcessor {
73+ export function getProcessor (
74+ filePathOrExtension : string ,
75+ options ?: ProcessorOptions
76+ ) : BaseProcessor {
7477 // Extract extension from file path
7578 const extension = filePathOrExtension . includes ( '.' )
7679 ? filePathOrExtension . substring ( filePathOrExtension . lastIndexOf ( '.' ) )
7780 : filePathOrExtension ;
7881
7982 switch ( extension . toLowerCase ( ) ) {
8083 case '.dot' :
81- return new DotProcessor ( ) ;
84+ return new DotProcessor ( options ) ;
8285 case '.xlsx' :
83- return new ExcelProcessor ( ) ;
86+ return new ExcelProcessor ( options ) ;
8487 case '.opml' :
85- return new OpmlProcessor ( ) ;
88+ return new OpmlProcessor ( options ) ;
8689 case '.obf' :
8790 case '.obz' :
88- return new ObfProcessor ( ) ;
91+ return new ObfProcessor ( options ) ;
8992 case '.obfset' :
90- return new ObfsetProcessor ( ) ;
93+ return new ObfsetProcessor ( options ) ;
9194 case '.gridset' :
9295 case '.gridsetx' :
93- return new GridsetProcessor ( ) ;
96+ return new GridsetProcessor ( options ) ;
9497 case '.spb' :
9598 case '.sps' :
96- return new SnapProcessor ( ) ;
99+ return new SnapProcessor ( options ) ;
97100 case '.ce' :
98- return new TouchChatProcessor ( ) ;
101+ return new TouchChatProcessor ( options ) ;
99102 case '.plist' :
100- return new ApplePanelsProcessor ( ) ;
103+ return new ApplePanelsProcessor ( options ) ;
101104 case '.grd' :
102- return new AstericsGridProcessor ( ) ;
105+ return new AstericsGridProcessor ( options ) ;
103106 default :
104107 throw new Error ( `Unsupported file extension: ${ extension } ` ) ;
105108 }
0 commit comments