File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import {
37
37
TagOption ,
38
38
} from './types/yomitan/tagbank' ;
39
39
import path from 'path' ;
40
+ import { DictionaryIndex } from './builders/dictionaryIndex' ;
40
41
41
42
const INDEX_FILE_NAME = 'index.json' ;
42
43
const TERM_BANK_FILE_NAME = ( bankNumber : number ) =>
@@ -86,11 +87,20 @@ export class Dictionary {
86
87
* @param index - JSON object
87
88
* @returns
88
89
*/
89
- async setIndex ( index : DictionaryIndexType ) {
90
+ async setIndex (
91
+ index : DictionaryIndexType ,
92
+ directory : string = './' ,
93
+ fileName : string = 'index.json' ,
94
+ ) {
90
95
if ( ! index . format ) {
91
96
index . format = 3 ;
92
97
}
93
98
await this . saveJsonToZip ( INDEX_FILE_NAME , index ) ;
99
+
100
+ if ( directory || fileName ) {
101
+ const indexBuilder = new DictionaryIndex ( index ) ;
102
+ await indexBuilder . export ( directory , fileName ) ;
103
+ }
94
104
return this ;
95
105
}
96
106
You can’t perform that action at this time.
0 commit comments