Skip to content

Commit

Permalink
Add JSDoc comments and GitHub Actions workflow for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
khashashin committed May 22, 2024
1 parent cf62c5b commit 9e4eabc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@ce/transliteration",
"version": "0.1.0",
"version": "0.1.1",
"exports": "./translit.js"
}
12 changes: 6 additions & 6 deletions translit.js → translit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* The keys are the original characters, and the values are the corresponding transliterated characters.
* @constant {Object.<string, string>}
*/
export const translitMap = {
export const translitMap: { [key: string]: string } = {
'а': 'a', 'аь': 'ä', 'б': 'b', 'в': 'v', 'г': 'g', 'гӏ': 'ġ', 'ц': 'c', 'цӏ': 'ċ', 'д': 'd',
'е': 'e', 'ё': 'ö', 'ж': 'ƶ', 'з': 'z', 'и': 'i', 'й': 'y', 'к': 'k', 'кх': 'q', 'къ': 'q̇',
'кӏ': 'k̇', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o', 'оь': 'ö', 'п': 'p', 'пӏ': 'ṗ', 'р': 'r',
Expand All @@ -41,12 +41,12 @@ export const translitMap = {
* console.log(result); // prints 'djaẋädira'
* ```
*/
export function apply(word) {
const w = word.toLowerCase();
let result = '';
let i = 0;
export function apply(word: string): string {
const w: string = word.toLowerCase();
let result: string = '';
let i: number = 0;
while (i < w.length) {
let match = null;
let match: string | null = null;
for (let key of [
w.substring(i, i + 3),
w.substring(i, i + 2),
Expand Down

0 comments on commit 9e4eabc

Please sign in to comment.