Skip to content

Commit

Permalink
Rewrite everything
Browse files Browse the repository at this point in the history
- Note: Tests still WIP
- search done
- list pretty much done
- rest to follow
  • Loading branch information
corscheid committed Nov 22, 2023
1 parent 80b8980 commit 9bdd8a4
Show file tree
Hide file tree
Showing 37 changed files with 1,324 additions and 6,905 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ console.log(results)
### Translate Na'vi numbers

```typescript
import { numbers } from "fwew.js"
import { numbers } from 'fwew.js'

const result = numbers.naviToNumber("mevopey")
const result = numbers.naviToNumber('mevopey')
console.log(result)
```

### Convert numbers to Na'vi

```typescript
import { numbers } from "fwew.js"
import { numbers } from 'fwew.js'

const result = numbers.numberToNavi(42)
console.log(result)
Expand Down
50 changes: 0 additions & 50 deletions lib/affixes.d.ts

This file was deleted.

19 changes: 19 additions & 0 deletions lib/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export declare const endpoints: {
fwew_url: string;
fwew_1d_url: string;
fwew_simple_url: string;
fwew_reverse_url: string;
fwew_1d_reverse_url: string;
search_url: string;
list_url: string;
list_filter_url: string;
random_url: string;
random_filter_url: string;
number_to_navi_url: string;
navi_to_number_url: string;
lenition_url: string;
version_url: string;
name_single_url: string;
name_full_url: string;
name_alu_url: string;
};
54 changes: 38 additions & 16 deletions lib/fwew.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
import { Word } from './word';
import type { LanguageCode, Word } from './types';
/**
* Translate some Na'vi text.
*
* !! Only one word is allowed, if spaces are found, they will be treated like part of the word !!
* This will return an array of Words, that fit the input text
* One Navi-Word can have multiple meanings and words (e.g. synonyms)
*
* @param {string} searchNaviWord word to search
* @return {Word[]} array of matching Fwew Word
* Search 1 or more words in both directions (Na'vi first)
* @param {LanguageCode} lang
* @param {string} words
* @returns {Word[][]}
*/
export declare function translateFromNavi(searchNaviWord: string): Word[];
declare function search(lang: LanguageCode, words: string): Promise<Word[][]>;
/**
* Translate some localized text
*
* @param {string} searchWord - localized word to lookup
* @param {string} langCode - language code
* @returns {Word[]} array of matching Fwew Word
* Search 1 or more words Na'vi -> Local
* @param {string} navi
* @returns {Word[][]}
*/
export declare function translateToNavi(searchWord: string, langCode: string): Word[];
declare function fwew(navi: string): Promise<Word[][]>;
/**
* Search 1 or more words Local -> Na'vi
* @param {LanguageCode} lang
* @param {string} local
* @returns {Word[][]}
*/
declare function fwewReverse(lang: LanguageCode, local: string): Promise<Word[][]>;
/**
* Search 1 or more words Na'vi -> Local, return only 1D array
* @param {string} navi
* @returns {Word[]}
*/
declare function fwew1D(navi: string): Promise<Word[]>;
/**
* Search 1 or more words Local -> Na'vi, return only 1D array
* @param {LanguageCode} lang
* @param {string} local
* @returns {Word[]}
*/
declare function fwew1DReverse(lang: LanguageCode, local: string): Promise<Word[]>;
/**
* Search 1 or more words Na'vi -> Local, ignoring all affixed words
* Use this only when you know you are searching a listed root word
* @param {string} navi
* @returns {Word[][]}
*/
declare function fwewSimple(navi: string): Promise<Word[][]>;
export { fwew, fwew1D, fwew1DReverse, fwewReverse, fwewSimple, search };
11 changes: 5 additions & 6 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as fwew from './fwew';
import { Affix, WordData, Word, getWords } from './word';
import { fwew, fwew1D, fwew1DReverse, fwewReverse, fwewSimple, search } from './fwew';
import { list } from './list';
import { nameAlu, nameFull, nameSingle } from './names';
import { naviToNumber, numberToNavi } from './numbers';
import { random } from './random';
import * as numbers from './numbers';
import { getLenitionTable, prefix, suffix, infix, lenite, reconstruct } from './affixes';
import * as util from './util';
export { fwew, Affix, WordData, Word, getWords, list, random, numbers, getLenitionTable, prefix, suffix, infix, lenite, reconstruct, util };
import { lenition, version } from './util';
export { fwew, fwew1D, fwew1DReverse, fwewReverse, fwewSimple, lenition, list, nameAlu, nameFull, nameSingle, naviToNumber, numberToNavi, random, search, version };
Loading

0 comments on commit 9bdd8a4

Please sign in to comment.