-
Notifications
You must be signed in to change notification settings - Fork 0
/
cjk-conv.d.ts
545 lines (534 loc) · 17 KB
/
cjk-conv.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
// Generated by dts-bundle v0.7.3
declare module 'cjk-conv' {
/**
* Created by user on 2018/2/17/017.
*/
export * from 'cjk-conv/lib/index';
import cjkConv from 'cjk-conv/lib/index';
export const version: string;
export { cjkConv };
export default cjkConv;
}
declare module 'cjk-conv/lib/index' {
/**
* Created by user on 2018/2/17/017.
*/
export { default as zhConvert, tw2cn, cn2tw } from 'cjk-conv/lib/zh/convert/index';
export { default as zhTable, IOptions as IOptionsZhTable } from 'cjk-conv/lib/zh/table/index';
export { default as jpConvert, zh2jp, jp2zht, jp2zhs, cjk2zht, cjk2zhs, cjk2jp } from 'cjk-conv/lib/jp/index';
export { default as novelFilename } from 'cjk-conv/lib/novel/filename';
import * as cjkConv from 'cjk-conv/lib/index';
export default cjkConv;
}
declare module 'cjk-conv/lib/zh/convert/index' {
/**
* Created by user on 2018/2/15/015.
*
* same as chinese_convert, but a little bug fix
*/
import { _call, defaultOptions, getOptions, getOptionsSkip, IOptions, ITable, REGEXP_TEST, SAFE_MODE_CHAR } from 'cjk-conv/lib/zh/convert/core';
import * as zhConvert from 'cjk-conv/lib/zh/convert/index';
export function cn2tw(text: string, options?: IOptions, ...argv: any[]): string;
export function tw2cn(text: string, options?: IOptions, ...argv: any[]): string;
export let table_cn2tw: ITable;
export let table_tw2cn: ITable;
export function _cn2tw(text: string): string;
export function _tw2cn(text: string): string;
export { _call, IOptions, ITable, getOptions, defaultOptions, REGEXP_TEST, getOptionsSkip, SAFE_MODE_CHAR, };
export default zhConvert;
}
declare module 'cjk-conv/lib/zh/table/index' {
/**
* Created by user on 2018/2/17/017.
*/
import libTable from 'cjk-conv/lib/zh/table/table';
export { libTable };
export type IOptions = {
safe?: boolean;
skip?: any;
};
export function _get(a: any, value: any, ...values: any[]): any;
/**
* 取出此漢字所對應的繁漢字
* @type {(char: string, options?: IOptions) => string[]}
*/
export const tw: (char: string, options?: IOptions) => string[];
/**
* 取出此漢字所對應的簡漢字
* @type {(char: string, options?: IOptions) => string[]}
*/
export const cn: (char: string, options?: IOptions) => string[];
/**
* 取出此漢字所對應的日漢字
* @type {(char: string, options?: IOptions) => string[]}
*/
export const jp: (char: string, options?: IOptions) => string[];
/**
* 自動取出此漢字所對應的簡繁日漢字
*
* @param {string} char
* @param {IOptions} options
* @returns {string[]}
*/
export function auto(char: string, options?: IOptions): string[];
import * as zhTable from 'cjk-conv/lib/zh/table/index';
export default zhTable;
}
declare module 'cjk-conv/lib/jp/index' {
/**
* Created by user on 2018/2/17/017.
*/
export { zh2jp, zht2jp, zhs2jp, zhs2zht, zht2zhs, cjk2zhs, jp2zhs, jp2zht, cjk2zht, cjk2jp, IOptions } from 'cjk-conv/lib/jp/core';
import * as jpConvert from 'cjk-conv/lib/jp/index';
export default jpConvert;
}
declare module 'cjk-conv/lib/novel/filename' {
/**
* Created by user on 2018/2/17/017.
*/
export interface IOptions {
skip?: string;
safe?: boolean;
}
export function filename(name: string, options?: IOptions): string;
export function word(name: string, options?: IOptions): string;
export function jp(txt: string, options?: IOptions): string;
export function zh(txt: string, options?: IOptions): string;
import * as novelFilename from 'cjk-conv/lib/novel/filename';
export default novelFilename;
}
declare module 'cjk-conv/lib/zh/convert/core' {
/**
* Created by user on 2018/8/2/002.
*/
import * as self from 'cjk-conv/lib/zh/convert/core';
export interface ITable {
[key: string]: string;
}
export function charMap(s: string, table: ITable): string;
export function textMap1(text: string, table: ITable): string;
export function textMap2(text: string, table: ITable): string;
export function textMap3(text: string, table: ITable): string;
export function textMap4(text: string, table: ITable): string;
export { textMap4 as textMap };
export default self;
export function removeSame(table: ITable): self.ITable;
export interface IOptions {
/**
* 忽略的字 or 任何支援 indexOf 的 Object
*/
skip?: any;
table?: ITable | typeof _call;
safe?: boolean;
tableOnly?: boolean;
}
export const defaultOptions: Readonly<{
safe: boolean;
}>;
export const REGEXP_TEST: RegExp;
export const SAFE_MODE_CHAR: string[];
export function getOptionsSkip(options: IOptions, skip?: string[]): self.IOptions;
export function getOptions(options?: IOptions, defaultOpts?: Readonly<{
safe: boolean;
}>, skip?: string[]): self.IOptions;
export function _call(fn: any, text: string, options?: IOptions, ...argv: any[]): any;
}
declare module 'cjk-conv/lib/zh/table/table' {
/**
* Created by user on 2018/2/17/017.
*/
import { IOptions } from 'cjk-conv/lib/zh/convert/core';
export let _table_tw: {
'罗': string;
'恶': string;
'苏': string;
'馆': string;
};
/**
* 此表內只有符合 KEY 值時才會觸發
*/
export let table_jp: {
'の': string[];
'と': string[];
'画': string[];
'闘': string[];
'鬥': string[];
'鬭': string[];
'鬪': string[];
'闇': string[];
'図': string[];
'当': string[];
'閤': string[];
'阁': string[];
'罗': string[];
'干': string[];
'幹': string[];
'乾': string[];
'亁': string[];
'乹': string[];
'历': string[];
'歴': string[];
'歷': string[];
'暦': string[];
'曆': string[];
'呻': string[];
'覆': string[];
'勉': string[];
'勉': string[];
'甦': string[];
'忧': string[];
'鹹': string[];
'准': string[];
'準': string[];
'袮': string[];
'儘': string[];
'侭': string[];
'脏': string[];
'发': string[];
'髮': string[];
'慾': string[];
'讚': string[];
'冲': string[];
'面': string[];
'鬚': string[];
'揹': string[];
'捲': string[];
'卷': string[];
'巻': string[];
'苏': string[];
'瀏': string[];
'浏': string[];
'吁': string[];
'囉': string[];
'啰': string[];
'修': string[];
'犟': string[];
'嗬': string[];
'唿': string[];
'媮': string[];
'采': string[];
'彩': string[];
'𠩺': string[];
};
/**
* 此表內符合以下任意值時會觸發
*/
export let table_plus: {
'劍': string[];
'砲': string[];
'偽': string[];
'內': string[];
'鬥': string[];
'鶏': string[];
'兎': string[];
'坏': string[];
'殻': string[];
'像': string[];
'蘇': string[];
'館': string[];
'鳥': string[];
'視': string[];
'険': string[];
'絶': string[];
'鉄': string[];
'諸': string[];
'尋': string[];
'裡': string[];
'鑑': string[];
'麵': string[];
'歲': string[];
'鐘': string[];
'會': string[];
'塗': string[];
'髮': string[];
'話': string[];
'閤': string[];
'蔘': string[];
'労': string[];
'国': string[];
'罵': string[];
'対': string[];
'鏽': string[];
'駄': string[];
'薩': string[];
'単': string[];
'継': string[];
'驗': string[];
'歴': string[];
'暦': string[];
'団': string[];
'麼': string[];
'戰': string[];
'乡': string[];
'勉': string[];
'餘': string[];
'網': string[];
'託': string[];
'纖': string[];
'鍊': string[];
'擊': string[];
'實': string[];
'於': string[];
'證': string[];
'據': string[];
'處': string[];
'瞪': string[];
'肢': string[];
'肉': string[];
'憂': string[];
'繫': string[];
'廻': string[];
'録': string[];
'鎗': string[];
'悠': string[];
'壶': string[];
'茲': string[];
'蓋': string[];
'蹟': string[];
'癒': string[];
'辺': string[];
'準': string[];
'衛': string[];
'晚': string[];
'裸': string[];
'亀': string[];
'凼': string[];
'艸': string[];
'札': string[];
'复': string[];
'污': string[];
'伙': string[];
'御': string[];
'鬱': string[];
'淩': string[];
'紮': string[];
'痴': string[];
'栖': string[];
'犇': string[];
'範': string[];
'薑': string[];
'樸': string[];
'諮': string[];
'撚': string[];
'喂': string[];
'淨': string[];
'栗': string[];
'挽': string[];
'灶': string[];
'線': string[];
'盡': string[];
'黴': string[];
'周': string[];
'並': string[];
'讚': string[];
'観': string[];
'遊': string[];
'启': string[];
'廄': string[];
'氣': string[];
'欲': string[];
'傑': string[];
'鍛': string[];
'徵': string[];
'閒': string[];
'贊': string[];
'櫻': string[];
'尨': string[];
'圈': string[];
'凶': string[];
'浜': string[];
'煙': string[];
'黒': string[];
'樂': string[];
'薬': string[];
'劵': string[];
'貳': string[];
'隷': string[];
'姫': string[];
'燻': string[];
'籲': string[];
'齧': string[];
'鹼': string[];
'咸': string[];
'穗': string[];
'廢': string[];
'蹠': string[];
'吒': string[];
'剷': string[];
'擗': string[];
'核': string[];
'脣': string[];
'升': string[];
'磐': string[];
'溪': string[];
'谿': string[];
'折': string[];
'祐': string[];
'瓮': string[];
'蹤': string[];
'暗': string[];
'昵': string[];
'布': string[];
'為': string[];
'綳': string[];
'痺': string[];
'痲': string[];
'雇': string[];
'敘': string[];
'盪': string[];
'勛': string[];
'祕': string[];
'牆': string[];
};
export interface ISimpleTable {
[key: string]: string;
}
export let _table_cn: ISimpleTable;
export function _update(target: ISimpleTable, source: ISimpleTable): ISimpleTable;
export function _get(arr: string[], value: string | string[], ...values: Array<string | string[]>): string[];
export function jp(char: string, options?: IOptions): string[];
export function tw(char: string, options?: IOptions): string[];
export function cn(char: string, options?: IOptions): string[];
import * as self from 'cjk-conv/lib/zh/table/table';
export default self;
}
declare module 'cjk-conv/lib/jp/core' {
/**
* Created by user on 2017/12/24/024.
*
* this module only do the char is exists in jp, zht, zhs
* so don't use this module when u wanna fully zht <=> zhs
*
* 目前只支援 簡繁日漢字 並非全 cjk 漢字支援
*/
import ZHJP_TABLE, { TABLE_SAFE as ZHJP_TABLE_SAFE } from 'cjk-conv/lib/jp/table';
export { ZHJP_TABLE, ZHJP_TABLE_SAFE };
export const KEY_JP = "jp";
export const KEY_ZHT = "zht";
export const KEY_ZHS = "zhs";
export let TABLE: {
jp: ITABLE;
zht: ITABLE;
zhs: ITABLE;
};
export let TABLE_SAFE: {
jp: ITABLE;
zht: ITABLE;
zhs: ITABLE;
};
export interface ITABLE {
[key: string]: ITABLESUB;
}
export interface ITABLESUB {
jp: string;
zht: string;
zhs: string;
}
export interface IOptions {
/**
* 忽略的字 or 任何支援 indexOf 的 Object
*/
skip?: any;
/**
* safe mode
*/
safe?: boolean;
}
export const defaultOptions: IOptions;
/**
* only 只將 日文漢字 => 轉為繁漢字
* @type {IFrom2To}
*/
export const jp2zht: IFrom2To;
/**
* only 只將 日文漢字 => 轉為簡漢字
* @type {IFrom2To}
*/
export const jp2zhs: IFrom2To;
/**
* only 簡漢字 => 轉為日漢字
* @type {IFrom2To}
*/
export const zhs2jp: IFrom2To;
/**
* only 只將 繁漢字 => 轉為日文漢字
* @type {IFrom2To}
*/
export const zht2jp: IFrom2To;
/**
* only 只將簡繁日 當中共通的 繁漢字 => 轉為簡漢字
* 請勿作為簡繁轉換用
* @type {IFrom2To}
*/
export const zht2zhs: IFrom2To;
/**
* only 只將簡繁日 當中共通的 簡漢字 => 轉為繁漢字
* 請勿作為簡繁轉換用
* @type {IFrom2To}
*/
export const zhs2zht: IFrom2To;
/**
* only 只將簡繁日 當中共通的 簡繁漢字 => 轉為日文漢字
*
* @alias cjk2jp
*
* @param str
* @param {IOptions} options
* @returns {string}
*/
export function zh2jp(str: any, options?: IOptions): string;
/**
* only 只將簡繁日 當中共通的 簡繁漢字 => 轉為日文漢字
*
* @alias zh2jp
*
* @param str
* @param {IOptions} options
* @returns {string}
*/
export const cjk2jp: typeof zh2jp;
/**
* only 只將簡繁日 當中共通的 漢字 => 轉為繁體漢字
* 請勿作為簡繁轉換用
*
* @param str
* @param {IOptions} options
* @returns {string}
*/
export function cjk2zht(str: any, options?: IOptions): string;
/**
* only 只將簡繁日 當中共通的 漢字 => 轉為簡體漢字
* 請勿作為簡繁轉換用
*
* @param str
* @param {IOptions} options
* @returns {string}
*/
export function cjk2zhs(str: any, options?: IOptions): string;
export function init(overwrite?: boolean): {
jp: ITABLE;
zht: ITABLE;
zhs: ITABLE;
};
export function _getdata(char: string, from: string, to: string, safe?: boolean): string;
export interface IFrom2To extends Function {
(str: any, options?: IOptions): string;
}
import * as jpConvert from 'cjk-conv/lib/jp/core';
export default jpConvert;
}
declare module 'cjk-conv/lib/jp/table' {
/**
* Created by user on 2017/12/24/024.
*
* @see https://www.jcinfo.net/tw/tools/kanji
* @see http://dict.variants.moe.edu.tw/variants/rbt/japan_chinese_character_tiles.rbt?pageId=2981908
* @see https://en.wikipedia.org/wiki/List_of_j%C5%8Dy%C5%8D_kanji
* @see https://hanzi.unihan.com.cn/CJKCompare
* @see http://www5b.biglobe.ne.jp/%7Eharigaya/variants.html
*/
export let TABLE: string[][];
export let TABLE_SAFE: string[][];
export function addNew(table: string[][], jp: any, zht: any, zhs: any): string[][];
export default TABLE;
}