henkan 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CONTRIBUTING.md +25 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +82 -0
  4. package/SECURITY.md +20 -0
  5. package/dist/index.cjs.js +2257 -0
  6. package/dist/index.cjs.js.map +7 -0
  7. package/dist/index.mjs +2199 -0
  8. package/dist/index.mjs.map +7 -0
  9. package/dist/types/constants.d.ts +8 -0
  10. package/dist/types/constants.d.ts.map +1 -0
  11. package/dist/types/index.d.ts +4 -0
  12. package/dist/types/index.d.ts.map +1 -0
  13. package/dist/types/types.d.ts +680 -0
  14. package/dist/types/types.d.ts.map +1 -0
  15. package/dist/types/utils.d.ts +135 -0
  16. package/dist/types/utils.d.ts.map +1 -0
  17. package/docs/api/README.md +62 -0
  18. package/docs/api/functions/capitalizeString.md +27 -0
  19. package/docs/api/functions/convertJMdict.md +27 -0
  20. package/docs/api/functions/convertKanjiDic.md +27 -0
  21. package/docs/api/functions/convertKradFile.md +39 -0
  22. package/docs/api/functions/convertRadkFile.md +33 -0
  23. package/docs/api/functions/convertTanakaCorpus.md +33 -0
  24. package/docs/api/functions/generateAnkiNote.md +27 -0
  25. package/docs/api/functions/generateAnkiNotesFile.md +27 -0
  26. package/docs/api/functions/getKanji.md +57 -0
  27. package/docs/api/functions/getKanjiExtended.md +69 -0
  28. package/docs/api/functions/getWord.md +63 -0
  29. package/docs/api/functions/isStringArray.md +27 -0
  30. package/docs/api/functions/isValidArray.md +27 -0
  31. package/docs/api/functions/isValidArrayWithFirstElement.md +27 -0
  32. package/docs/api/functions/makeSSML.md +33 -0
  33. package/docs/api/functions/shuffleArray.md +33 -0
  34. package/docs/api/functions/synthesizeSpeech.md +39 -0
  35. package/docs/api/interfaces/DictKanji.md +43 -0
  36. package/docs/api/interfaces/DictKanjiForm.md +51 -0
  37. package/docs/api/interfaces/DictKanjiMisc.md +61 -0
  38. package/docs/api/interfaces/DictKanjiReading.md +31 -0
  39. package/docs/api/interfaces/DictKanjiReadingMeaning.md +33 -0
  40. package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +33 -0
  41. package/docs/api/interfaces/DictKanjiWithRadicals.md +33 -0
  42. package/docs/api/interfaces/DictMeaning.md +129 -0
  43. package/docs/api/interfaces/DictRadical.md +41 -0
  44. package/docs/api/interfaces/DictReading.md +61 -0
  45. package/docs/api/interfaces/DictWord.md +53 -0
  46. package/docs/api/interfaces/ExamplePart.md +75 -0
  47. package/docs/api/interfaces/Grammar.md +165 -0
  48. package/docs/api/interfaces/GrammarMeaning.md +31 -0
  49. package/docs/api/interfaces/Kana.md +125 -0
  50. package/docs/api/interfaces/Kanji.md +239 -0
  51. package/docs/api/interfaces/KanjiComponent.md +31 -0
  52. package/docs/api/interfaces/KanjiForm.md +33 -0
  53. package/docs/api/interfaces/Phrase.md +47 -0
  54. package/docs/api/interfaces/Radical.md +165 -0
  55. package/docs/api/interfaces/Reading.md +43 -0
  56. package/docs/api/interfaces/ResultEntry.md +75 -0
  57. package/docs/api/interfaces/TanakaExample.md +51 -0
  58. package/docs/api/interfaces/Translation.md +33 -0
  59. package/docs/api/interfaces/UsefulRegExps.md +93 -0
  60. package/docs/api/interfaces/Word.md +149 -0
  61. package/docs/api/type-aliases/Dict.md +13 -0
  62. package/docs/api/type-aliases/DictName.md +13 -0
  63. package/docs/api/type-aliases/EntryType.md +13 -0
  64. package/docs/api/type-aliases/JLPT.md +13 -0
  65. package/docs/api/type-aliases/Result.md +13 -0
  66. package/package.json +87 -0
@@ -0,0 +1,135 @@
1
+ import { PollyClient, SynthesizeSpeechCommandInput } from "@aws-sdk/client-polly";
2
+ import { DictKanji, DictKanjiWithRadicals, DictRadical, DictWord, Grammar, Kana, Kanji, Radical, Result, TanakaExample, Word } from "./types";
3
+ /**
4
+ * Capitalizes a string.
5
+ * @param value The string to capitalize
6
+ * @returns The capitalized string
7
+ */
8
+ export declare function capitalizeString(value: string): string;
9
+ /**
10
+ * Checks if the argument is an array.
11
+ * @param arg The argument
12
+ * @returns Whether or not {@link arg} is an array
13
+ */
14
+ export declare function isValidArray(arg: any): arg is any[];
15
+ /**
16
+ * Checks if the argument is an array and has at least one element.
17
+ * @param arg The argument
18
+ * @returns Whether or not {@link arg} is an array and has at least one element
19
+ */
20
+ export declare function isValidArrayWithFirstElement(arg: any): arg is any[];
21
+ /**
22
+ * Checks if the argument is an array of strings.
23
+ * @param arg The argument
24
+ * @returns Whether or not {@link arg} is an array of strings
25
+ */
26
+ export declare function isStringArray(arg: any): arg is string[];
27
+ /**
28
+ * Shuffles an array using the `Fisher–Yates shuffle` algorithm
29
+ * @param arr The array to be shuffled
30
+ * @returns The shuffled array
31
+ */
32
+ export declare function shuffleArray<T>(arr: T[]): T[];
33
+ /**
34
+ * Converts a JMdict `JMdict_e.xml`/`JMdict_e` file into an array of {@link DictWord} objects.
35
+ * @param xmlString The raw `JMdict_e.xml`/`JMdict_e` file contents
36
+ * @returns An array of converted {@link DictWord} objects
37
+ */
38
+ export declare function convertJMdict(xmlString: string): DictWord[];
39
+ /**
40
+ * Converts a KANJIDIC `kanjidic2.xml` file into an array of {@link DictKanji} objects.
41
+ * @param xmlString The raw `kanjidic2.xml` file contents
42
+ * @returns An array of converted {@link DictKanji} objects
43
+ */
44
+ export declare function convertKanjiDic(xmlString: string): DictKanji[];
45
+ /**
46
+ * Converts a Tanaka Corpus `examples.utf` file into an array of {@link TanakaExample} objects.
47
+ * @param tanakaString The raw contents of a `examples.utf` file
48
+ * @param generateFurigana Whether or not to generate furigana for the phrase
49
+ * @returns A promise resolving with an array of converted {@link TanakaExample} objects
50
+ */
51
+ export declare function convertTanakaCorpus(tanakaString: string, generateFurigana?: true): Promise<TanakaExample[]>;
52
+ /**
53
+ * Converts a `radkfile2` file into an array of {@link DictRadical} objects.
54
+ * @param radkBuffer A raw `radkfile2` buffer
55
+ * @param kanjiDic An array of converted `KANJIDIC` entries
56
+ * @returns An array of converted {@link DictRadical} objects
57
+ */
58
+ export declare function convertRadkFile(radkBuffer: NonSharedBuffer, kanjiDic: DictKanji[]): DictRadical[];
59
+ /**
60
+ * Converts a `kradfile2` file into an array of {@link DictKanjiWithRadicals} objects.
61
+ * @param kradBuffer A raw `kradfile2` buffer
62
+ * @param kanjiDic An array of converted `KANJIDIC` entries
63
+ * @param katakanaList An array of katakana {@link Kana} objects
64
+ * @returns An array of converted {@link DictKanjiWithRadicals} objects
65
+ */
66
+ export declare function convertKradFile(kradBuffer: NonSharedBuffer, kanjiDic: DictKanji[], katakanaList: Kana[]): DictKanjiWithRadicals[];
67
+ /**
68
+ * Transforms a converted `JMdict` entry into a more readable format, by providing either its {@link id} or the {@link dictWord} object directly.
69
+ * @param dict An array of converted `JMdict` entries
70
+ * @param id The ID of the `JMdict` entry
71
+ * @param kanjiDic An array of converted `KANJIDIC` entries
72
+ * @param examples An array of converted `Tanaka Corpus` examples
73
+ * @param dictWord The converted `JMdict` entry
74
+ * @param noteTypeName The Anki note type name
75
+ * @param deckPath The full Anki deck path
76
+ * @returns The transformed {@link Word} object
77
+ */
78
+ export declare function getWord(dict?: DictWord[], id?: string, kanjiDic?: DictKanji[], examples?: TanakaExample[], dictWord?: DictWord, noteTypeName?: string, deckPath?: string): Word;
79
+ /**
80
+ * Transforms a converted `KANJIDIC` entry into a more readable format
81
+ * @param kanjiChar The kanji character
82
+ * @param dict An array of converted `KANJIDIC` entries
83
+ * @param jmDict An array of converted `JMdict` entries
84
+ * @param svgList An array of SVG file names
85
+ * @param noteTypeName The Anki note type name
86
+ * @param deckPath The full Anki deck path
87
+ * @returns The transformed {@link Kanji} object
88
+ */
89
+ export declare function getKanji(kanjiChar: string, dict: DictKanji[], jmDict?: DictWord[], svgList?: string[], noteTypeName?: string, deckPath?: string): Kanji;
90
+ /**
91
+ * Same as {@link getKanji}, but with possible extra info.
92
+ * @param kanjiChar The kanji character
93
+ * @param info Additional info from `jpdb.io` for the kanji (mnemonic, components, words)
94
+ * @param dict An array of converted `KANJIDIC` entries
95
+ * @param useJpdbWords Whether or not to use the `jpdb.io` provided words (if present) instead of other words from `JMdict`
96
+ * @param jmDict An array of converted `JMdict` entries
97
+ * @param svgList An array of SVG file names
98
+ * @param noteTypeName The Anki note type name
99
+ * @param deckPath The full Anki deck path
100
+ * @returns The transformed {@link Kanji} object
101
+ */
102
+ export declare function getKanjiExtended(kanjiChar: string, info: Kanji, dict: DictKanji[], useJpdbWords?: true, jmDict?: DictWord[], svgList?: string[], noteTypeName?: string, deckPath?: string): Kanji;
103
+ /**
104
+ * Builds SSML text for Japanese words
105
+ * @param formText The normal form of the word (usually kanji form)
106
+ * @param fullReading The reading of the word (hiragana or katakana)
107
+ * @returns The SSML text
108
+ */
109
+ export declare function makeSSML(formText: string, fullReading: string): string;
110
+ /**
111
+ * Synthesizes text to speech audio using {@link [Amazon Polly](https://aws.amazon.com/polly/)}.
112
+ * @param client An Amazon Polly Client instance
113
+ * @param ssmlText The text to be spoken, in SSML format
114
+ * @param options Other speech generation settings
115
+ * @returns A promise resolving with an audio stream buffer or with `null` if the generation failed
116
+ */
117
+ export declare function synthesizeSpeech(client: PollyClient, ssmlText: string, options: Omit<SynthesizeSpeechCommandInput, "Text" | "TextType">): Promise<Buffer<ArrayBuffer> | null>;
118
+ export declare function isWord(entry: Result): entry is Word;
119
+ export declare function isRadical(entry: Result): entry is Radical;
120
+ export declare function isKanji(entry: Result): entry is Kanji;
121
+ export declare function isKana(entry: Result): entry is Kana;
122
+ export declare function isGrammar(entry: Result): entry is Grammar;
123
+ /**
124
+ * Generates an array where each field holds an entry’s info wrapped in HTML tags.
125
+ * @param entry Any type of mapped entry ({@link Word}, {@link Kanji}, {@link Radical}, {@link Kana}, {@link Grammar})
126
+ * @returns An array of fields, each corresponding to an Anki note type field
127
+ */
128
+ export declare function generateAnkiNote(entry: Result): string[];
129
+ /**
130
+ * Generates an Anki notes file with each entry’s info organized into fields, either in HTML or plain text.
131
+ * @param list An array containing any type of transformed entries ({@link Word}, {@link Kanji}, {@link Radical}, {@link Kana}, {@link Grammar})
132
+ * @returns The resulting Anki notes file's content or `undefined` if `list` is empty
133
+ */
134
+ export declare function generateAnkiNotesFile(list: Result[]): string | undefined;
135
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,62 @@
1
+ **henkan**
2
+
3
+ ***
4
+
5
+ # henkan
6
+
7
+ ## Interfaces
8
+
9
+ - [DictKanji](interfaces/DictKanji.md)
10
+ - [DictKanjiForm](interfaces/DictKanjiForm.md)
11
+ - [DictKanjiMisc](interfaces/DictKanjiMisc.md)
12
+ - [DictKanjiReading](interfaces/DictKanjiReading.md)
13
+ - [DictKanjiReadingMeaning](interfaces/DictKanjiReadingMeaning.md)
14
+ - [DictKanjiReadingMeaningGroup](interfaces/DictKanjiReadingMeaningGroup.md)
15
+ - [DictKanjiWithRadicals](interfaces/DictKanjiWithRadicals.md)
16
+ - [DictMeaning](interfaces/DictMeaning.md)
17
+ - [DictRadical](interfaces/DictRadical.md)
18
+ - [DictReading](interfaces/DictReading.md)
19
+ - [DictWord](interfaces/DictWord.md)
20
+ - [ExamplePart](interfaces/ExamplePart.md)
21
+ - [Grammar](interfaces/Grammar.md)
22
+ - [GrammarMeaning](interfaces/GrammarMeaning.md)
23
+ - [Kana](interfaces/Kana.md)
24
+ - [Kanji](interfaces/Kanji.md)
25
+ - [KanjiComponent](interfaces/KanjiComponent.md)
26
+ - [KanjiForm](interfaces/KanjiForm.md)
27
+ - [Phrase](interfaces/Phrase.md)
28
+ - [Radical](interfaces/Radical.md)
29
+ - [Reading](interfaces/Reading.md)
30
+ - [ResultEntry](interfaces/ResultEntry.md)
31
+ - [TanakaExample](interfaces/TanakaExample.md)
32
+ - [Translation](interfaces/Translation.md)
33
+ - [UsefulRegExps](interfaces/UsefulRegExps.md)
34
+ - [Word](interfaces/Word.md)
35
+
36
+ ## Type Aliases
37
+
38
+ - [Dict](type-aliases/Dict.md)
39
+ - [DictName](type-aliases/DictName.md)
40
+ - [EntryType](type-aliases/EntryType.md)
41
+ - [JLPT](type-aliases/JLPT.md)
42
+ - [Result](type-aliases/Result.md)
43
+
44
+ ## Functions
45
+
46
+ - [capitalizeString](functions/capitalizeString.md)
47
+ - [convertJMdict](functions/convertJMdict.md)
48
+ - [convertKanjiDic](functions/convertKanjiDic.md)
49
+ - [convertKradFile](functions/convertKradFile.md)
50
+ - [convertRadkFile](functions/convertRadkFile.md)
51
+ - [convertTanakaCorpus](functions/convertTanakaCorpus.md)
52
+ - [generateAnkiNote](functions/generateAnkiNote.md)
53
+ - [generateAnkiNotesFile](functions/generateAnkiNotesFile.md)
54
+ - [getKanji](functions/getKanji.md)
55
+ - [getKanjiExtended](functions/getKanjiExtended.md)
56
+ - [getWord](functions/getWord.md)
57
+ - [isStringArray](functions/isStringArray.md)
58
+ - [isValidArray](functions/isValidArray.md)
59
+ - [isValidArrayWithFirstElement](functions/isValidArrayWithFirstElement.md)
60
+ - [makeSSML](functions/makeSSML.md)
61
+ - [shuffleArray](functions/shuffleArray.md)
62
+ - [synthesizeSpeech](functions/synthesizeSpeech.md)
@@ -0,0 +1,27 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / capitalizeString
6
+
7
+ # Function: capitalizeString()
8
+
9
+ > **capitalizeString**(`value`): `string`
10
+
11
+ Defined in: utils.ts:52
12
+
13
+ Capitalizes a string.
14
+
15
+ ## Parameters
16
+
17
+ ### value
18
+
19
+ `string`
20
+
21
+ The string to capitalize
22
+
23
+ ## Returns
24
+
25
+ `string`
26
+
27
+ The capitalized string
@@ -0,0 +1,27 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / convertJMdict
6
+
7
+ # Function: convertJMdict()
8
+
9
+ > **convertJMdict**(`xmlString`): [`DictWord`](../interfaces/DictWord.md)[]
10
+
11
+ Defined in: utils.ts:121
12
+
13
+ Converts a JMdict `JMdict_e.xml`/`JMdict_e` file into an array of [DictWord](../interfaces/DictWord.md) objects.
14
+
15
+ ## Parameters
16
+
17
+ ### xmlString
18
+
19
+ `string`
20
+
21
+ The raw `JMdict_e.xml`/`JMdict_e` file contents
22
+
23
+ ## Returns
24
+
25
+ [`DictWord`](../interfaces/DictWord.md)[]
26
+
27
+ An array of converted [DictWord](../interfaces/DictWord.md) objects
@@ -0,0 +1,27 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / convertKanjiDic
6
+
7
+ # Function: convertKanjiDic()
8
+
9
+ > **convertKanjiDic**(`xmlString`): [`DictKanji`](../interfaces/DictKanji.md)[]
10
+
11
+ Defined in: utils.ts:254
12
+
13
+ Converts a KANJIDIC `kanjidic2.xml` file into an array of [DictKanji](../interfaces/DictKanji.md) objects.
14
+
15
+ ## Parameters
16
+
17
+ ### xmlString
18
+
19
+ `string`
20
+
21
+ The raw `kanjidic2.xml` file contents
22
+
23
+ ## Returns
24
+
25
+ [`DictKanji`](../interfaces/DictKanji.md)[]
26
+
27
+ An array of converted [DictKanji](../interfaces/DictKanji.md) objects
@@ -0,0 +1,39 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / convertKradFile
6
+
7
+ # Function: convertKradFile()
8
+
9
+ > **convertKradFile**(`kradBuffer`, `kanjiDic`, `katakanaList`): [`DictKanjiWithRadicals`](../interfaces/DictKanjiWithRadicals.md)[]
10
+
11
+ Defined in: utils.ts:552
12
+
13
+ Converts a `kradfile2` file into an array of [DictKanjiWithRadicals](../interfaces/DictKanjiWithRadicals.md) objects.
14
+
15
+ ## Parameters
16
+
17
+ ### kradBuffer
18
+
19
+ `NonSharedBuffer`
20
+
21
+ A raw `kradfile2` buffer
22
+
23
+ ### kanjiDic
24
+
25
+ [`DictKanji`](../interfaces/DictKanji.md)[]
26
+
27
+ An array of converted `KANJIDIC` entries
28
+
29
+ ### katakanaList
30
+
31
+ [`Kana`](../interfaces/Kana.md)[]
32
+
33
+ An array of katakana [Kana](../interfaces/Kana.md) objects
34
+
35
+ ## Returns
36
+
37
+ [`DictKanjiWithRadicals`](../interfaces/DictKanjiWithRadicals.md)[]
38
+
39
+ An array of converted [DictKanjiWithRadicals](../interfaces/DictKanjiWithRadicals.md) objects
@@ -0,0 +1,33 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / convertRadkFile
6
+
7
+ # Function: convertRadkFile()
8
+
9
+ > **convertRadkFile**(`radkBuffer`, `kanjiDic`): [`DictRadical`](../interfaces/DictRadical.md)[]
10
+
11
+ Defined in: utils.ts:487
12
+
13
+ Converts a `radkfile2` file into an array of [DictRadical](../interfaces/DictRadical.md) objects.
14
+
15
+ ## Parameters
16
+
17
+ ### radkBuffer
18
+
19
+ `NonSharedBuffer`
20
+
21
+ A raw `radkfile2` buffer
22
+
23
+ ### kanjiDic
24
+
25
+ [`DictKanji`](../interfaces/DictKanji.md)[]
26
+
27
+ An array of converted `KANJIDIC` entries
28
+
29
+ ## Returns
30
+
31
+ [`DictRadical`](../interfaces/DictRadical.md)[]
32
+
33
+ An array of converted [DictRadical](../interfaces/DictRadical.md) objects
@@ -0,0 +1,33 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / convertTanakaCorpus
6
+
7
+ # Function: convertTanakaCorpus()
8
+
9
+ > **convertTanakaCorpus**(`tanakaString`, `generateFurigana?`): `Promise`\<[`TanakaExample`](../interfaces/TanakaExample.md)[]\>
10
+
11
+ Defined in: utils.ts:370
12
+
13
+ Converts a Tanaka Corpus `examples.utf` file into an array of [TanakaExample](../interfaces/TanakaExample.md) objects.
14
+
15
+ ## Parameters
16
+
17
+ ### tanakaString
18
+
19
+ `string`
20
+
21
+ The raw contents of a `examples.utf` file
22
+
23
+ ### generateFurigana?
24
+
25
+ `true`
26
+
27
+ Whether or not to generate furigana for the phrase
28
+
29
+ ## Returns
30
+
31
+ `Promise`\<[`TanakaExample`](../interfaces/TanakaExample.md)[]\>
32
+
33
+ A promise resolving with an array of converted [TanakaExample](../interfaces/TanakaExample.md) objects
@@ -0,0 +1,27 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / generateAnkiNote
6
+
7
+ # Function: generateAnkiNote()
8
+
9
+ > **generateAnkiNote**(`entry`): `string`[]
10
+
11
+ Defined in: utils.ts:1422
12
+
13
+ Generates an array where each field holds an entry’s info wrapped in HTML tags.
14
+
15
+ ## Parameters
16
+
17
+ ### entry
18
+
19
+ [`Result`](../type-aliases/Result.md)
20
+
21
+ Any type of mapped entry ([Word](../interfaces/Word.md), [Kanji](../interfaces/Kanji.md), [Radical](../interfaces/Radical.md), [Kana](../interfaces/Kana.md), [Grammar](../interfaces/Grammar.md))
22
+
23
+ ## Returns
24
+
25
+ `string`[]
26
+
27
+ An array of fields, each corresponding to an Anki note type field
@@ -0,0 +1,27 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / generateAnkiNotesFile
6
+
7
+ # Function: generateAnkiNotesFile()
8
+
9
+ > **generateAnkiNotesFile**(`list`): `undefined` \| `string`
10
+
11
+ Defined in: utils.ts:1720
12
+
13
+ Generates an Anki notes file with each entry’s info organized into fields, either in HTML or plain text.
14
+
15
+ ## Parameters
16
+
17
+ ### list
18
+
19
+ [`Result`](../type-aliases/Result.md)[]
20
+
21
+ An array containing any type of transformed entries ([Word](../interfaces/Word.md), [Kanji](../interfaces/Kanji.md), [Radical](../interfaces/Radical.md), [Kana](../interfaces/Kana.md), [Grammar](../interfaces/Grammar.md))
22
+
23
+ ## Returns
24
+
25
+ `undefined` \| `string`
26
+
27
+ The resulting Anki notes file's content or `undefined` if `list` is empty
@@ -0,0 +1,57 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / getKanji
6
+
7
+ # Function: getKanji()
8
+
9
+ > **getKanji**(`kanjiChar`, `dict`, `jmDict?`, `svgList?`, `noteTypeName?`, `deckPath?`): [`Kanji`](../interfaces/Kanji.md)
10
+
11
+ Defined in: utils.ts:927
12
+
13
+ Transforms a converted `KANJIDIC` entry into a more readable format
14
+
15
+ ## Parameters
16
+
17
+ ### kanjiChar
18
+
19
+ `string`
20
+
21
+ The kanji character
22
+
23
+ ### dict
24
+
25
+ [`DictKanji`](../interfaces/DictKanji.md)[]
26
+
27
+ An array of converted `KANJIDIC` entries
28
+
29
+ ### jmDict?
30
+
31
+ [`DictWord`](../interfaces/DictWord.md)[]
32
+
33
+ An array of converted `JMdict` entries
34
+
35
+ ### svgList?
36
+
37
+ `string`[]
38
+
39
+ An array of SVG file names
40
+
41
+ ### noteTypeName?
42
+
43
+ `string`
44
+
45
+ The Anki note type name
46
+
47
+ ### deckPath?
48
+
49
+ `string`
50
+
51
+ The full Anki deck path
52
+
53
+ ## Returns
54
+
55
+ [`Kanji`](../interfaces/Kanji.md)
56
+
57
+ The transformed [Kanji](../interfaces/Kanji.md) object
@@ -0,0 +1,69 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / getKanjiExtended
6
+
7
+ # Function: getKanjiExtended()
8
+
9
+ > **getKanjiExtended**(`kanjiChar`, `info`, `dict`, `useJpdbWords?`, `jmDict?`, `svgList?`, `noteTypeName?`, `deckPath?`): [`Kanji`](../interfaces/Kanji.md)
10
+
11
+ Defined in: utils.ts:1162
12
+
13
+ Same as [getKanji](getKanji.md), but with possible extra info.
14
+
15
+ ## Parameters
16
+
17
+ ### kanjiChar
18
+
19
+ `string`
20
+
21
+ The kanji character
22
+
23
+ ### info
24
+
25
+ [`Kanji`](../interfaces/Kanji.md)
26
+
27
+ Additional info from `jpdb.io` for the kanji (mnemonic, components, words)
28
+
29
+ ### dict
30
+
31
+ [`DictKanji`](../interfaces/DictKanji.md)[]
32
+
33
+ An array of converted `KANJIDIC` entries
34
+
35
+ ### useJpdbWords?
36
+
37
+ `true`
38
+
39
+ Whether or not to use the `jpdb.io` provided words (if present) instead of other words from `JMdict`
40
+
41
+ ### jmDict?
42
+
43
+ [`DictWord`](../interfaces/DictWord.md)[]
44
+
45
+ An array of converted `JMdict` entries
46
+
47
+ ### svgList?
48
+
49
+ `string`[]
50
+
51
+ An array of SVG file names
52
+
53
+ ### noteTypeName?
54
+
55
+ `string`
56
+
57
+ The Anki note type name
58
+
59
+ ### deckPath?
60
+
61
+ `string`
62
+
63
+ The full Anki deck path
64
+
65
+ ## Returns
66
+
67
+ [`Kanji`](../interfaces/Kanji.md)
68
+
69
+ The transformed [Kanji](../interfaces/Kanji.md) object
@@ -0,0 +1,63 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / getWord
6
+
7
+ # Function: getWord()
8
+
9
+ > **getWord**(`dict?`, `id?`, `kanjiDic?`, `examples?`, `dictWord?`, `noteTypeName?`, `deckPath?`): [`Word`](../interfaces/Word.md)
10
+
11
+ Defined in: utils.ts:659
12
+
13
+ Transforms a converted `JMdict` entry into a more readable format, by providing either its [id](#getword) or the [dictWord](#getword) object directly.
14
+
15
+ ## Parameters
16
+
17
+ ### dict?
18
+
19
+ [`DictWord`](../interfaces/DictWord.md)[]
20
+
21
+ An array of converted `JMdict` entries
22
+
23
+ ### id?
24
+
25
+ `string`
26
+
27
+ The ID of the `JMdict` entry
28
+
29
+ ### kanjiDic?
30
+
31
+ [`DictKanji`](../interfaces/DictKanji.md)[]
32
+
33
+ An array of converted `KANJIDIC` entries
34
+
35
+ ### examples?
36
+
37
+ [`TanakaExample`](../interfaces/TanakaExample.md)[]
38
+
39
+ An array of converted `Tanaka Corpus` examples
40
+
41
+ ### dictWord?
42
+
43
+ [`DictWord`](../interfaces/DictWord.md)
44
+
45
+ The converted `JMdict` entry
46
+
47
+ ### noteTypeName?
48
+
49
+ `string`
50
+
51
+ The Anki note type name
52
+
53
+ ### deckPath?
54
+
55
+ `string`
56
+
57
+ The full Anki deck path
58
+
59
+ ## Returns
60
+
61
+ [`Word`](../interfaces/Word.md)
62
+
63
+ The transformed [Word](../interfaces/Word.md) object
@@ -0,0 +1,27 @@
1
+ [**henkan**](../README.md)
2
+
3
+ ***
4
+
5
+ [henkan](../README.md) / isStringArray
6
+
7
+ # Function: isStringArray()
8
+
9
+ > **isStringArray**(`arg`): `arg is string[]`
10
+
11
+ Defined in: utils.ts:85
12
+
13
+ Checks if the argument is an array of strings.
14
+
15
+ ## Parameters
16
+
17
+ ### arg
18
+
19
+ `any`
20
+
21
+ The argument
22
+
23
+ ## Returns
24
+
25
+ `arg is string[]`
26
+
27
+ Whether or not [arg](#isstringarray) is an array of strings