declare.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { ENUM_PINYIN_STYLE, ENUM_PINYIN_MODE } from "./constant";
  2. export interface IPinyin {
  3. (han: string, options?: IPinyinOptions): string[][];
  4. compare: (a: string, b: string) => number;
  5. compact: (arr: string[][]) => string[][];
  6. STYLE_TONE: ENUM_PINYIN_STYLE;
  7. STYLE_TONE2: ENUM_PINYIN_STYLE;
  8. STYLE_TO3NE: ENUM_PINYIN_STYLE;
  9. STYLE_NORMAL: ENUM_PINYIN_STYLE;
  10. STYLE_INITIALS: ENUM_PINYIN_STYLE;
  11. STYLE_FIRST_LETTER: ENUM_PINYIN_STYLE;
  12. STYLE_PASSPORT: ENUM_PINYIN_STYLE;
  13. MODE_NORMAL: ENUM_PINYIN_MODE;
  14. MODE_SURNAME: ENUM_PINYIN_MODE;
  15. }
  16. export declare type IPinyinStyle = ENUM_PINYIN_STYLE | "normal" | "tone" | "tone2" | "to3ne" | "initials" | "first_letter" | "passport" | "NORMAL" | "TONE" | "TONE2" | "TO3NE" | "INITIALS" | "FIRST_LETTER" | "PASSPORT" | 0 | 1 | 2 | 5 | 3 | 4;
  17. export declare type IPinyinMode = ENUM_PINYIN_MODE | "normal" | "surname" | "NORMAL" | "SURNAME";
  18. export declare type IPinyinSegment = "nodejieba" | "segmentit" | "@node-rs/jieba" | "Intl.Segmenter";
  19. export interface IPinyinAllOptions {
  20. style: ENUM_PINYIN_STYLE;
  21. mode: ENUM_PINYIN_MODE;
  22. segment?: IPinyinSegment;
  23. heteronym: boolean;
  24. group: boolean;
  25. compact: boolean;
  26. }
  27. export interface IPinyinOptions {
  28. style?: IPinyinStyle;
  29. mode?: IPinyinMode;
  30. segment?: IPinyinSegment | boolean;
  31. heteronym?: boolean;
  32. group?: boolean;
  33. compact?: boolean;
  34. }