-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
55 lines (47 loc) · 1.34 KB
/
index.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
export interface Language {
/** Languages. */
lang: string,
/** Abbreviations used. */
abbr: string
}
/**
* Loads corpus to enable queries.
* [📦](https://www.npmjs.com/package/@ifct2017/languages)
* @returns corpus {abbr ⇒ {abbr, lang}}
*/
export function load() : Map<string, Language>;
/**
* Generates PostgreSQL statements for creating table w/ data.
* [📦](https://www.npmjs.com/package/@ifct2017/languages)
* @returns CREATE TABLE, INSERT, CREATE VIEW, CREATE INDEX statements
*/
export function sql(tab: string='languages', opt: object={}) : string;
/**
* Gives path of CSV data file.
* [📦](https://www.npmjs.com/package/@ifct2017/languages)
* @returns .../index.csv
*/
export function csv() : string;
/**
* Finds matching languages of an abbr/lang query.
* [📦](https://www.npmjs.com/package/@ifct2017/languages)
* @param txt abbr/lang query
* @returns matches [{abbr, lang}]
* @example
* ```javascript
* languages('mal.');
* languages('Mal');
* // { abbr: 'Mal.', lang: 'Malayalam' }
*
* languages('what is s.?');
* languages('S. stands for?');
* // { abbr: 'S.', lang: 'Sanskrit' }
*
*
* // Note:
* // Full stops must immediately follow character, if present.
* // For single character abbreviations, full stop is mandatory.
* ```
*/
function languages(txt: string): [Language];
export = languages;