-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
55 lines (47 loc) · 1.45 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 Abbreviation {
/** Abbreviation. */
abbr: string,
/** Full form. */
full: string
}
/**
* Loads corpus to enable queries.
* [📦](https://www.npmjs.com/package/@ifct2017/abbreviations)
* @returns corpus {key ⇒ {abbr, full}}
*/
export function load() : Map<string, Abbreviation>;
/**
* Generates PostgreSQL statements for creating table w/ data.
* [📦](https://www.npmjs.com/package/@ifct2017/abbreviations)
* @returns CREATE TABLE, INSERT, CREATE VIEW, CREATE INDEX statements
*/
export function sql(tab: string='abbreviations', opt: object={}) : string;
/**
* Gives path of CSV data file.
* [📦](https://www.npmjs.com/package/@ifct2017/abbreviations)
* @returns .../index.csv
*/
export function csv() : string;
/**
* Finds matching full form of an abbreviation query.
* [📦](https://www.npmjs.com/package/@ifct2017/abbreviations)
* @param txt abbreviation query
* @returns found ⇒ {abbr, full}, else ⇒ null
* @example
* ```javascript
* abbreviations('GLV');
* abbreviations('g l v');
* // { abbr: 'GLV', full: 'Green Leafy Vegetables' }
*
* abbreviations('what is D.R.I.');
* abbreviations('d. r. i. stands for?');
* // { abbr: 'DRI', full: 'Dietary reference intake' }
*
*
* // Note:
* // for single character abbreviations, full stop is mandatory
* // full stops must immediately follow character, if present
* ```
*/
function abbreviations(txt: string): Abbreviation | null;
export = abbreviations;