-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
56 lines (48 loc) · 1.51 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
56
export interface Column {
/** Column Code. */
code: string,
/** Column Name. */
name: string,
/** Tags. */
tags: string
}
/**
* Loads corpus to enable queries.
* [📦](https://www.npmjs.com/package/@ifct2017/columns)
* @returns corpus {code ⇒ {code, name, tags}}
*/
export function load() : Map<string, Column>;
/**
* Generates PostgreSQL statements for creating table w/ data.
* [📦](https://www.npmjs.com/package/@ifct2017/columns)
* @returns CREATE TABLE, INSERT, CREATE VIEW, CREATE INDEX statements
*/
export function sql(tab: string='columns', opt: object={}) : string;
/**
* Gives path of CSV data file.
* [📦](https://www.npmjs.com/package/@ifct2017/columns)
* @returns .../index.csv
*/
export function csv() : string;
/**
* Finds matching columns of an code/name/tags query.
* [📦](https://www.npmjs.com/package/@ifct2017/columns)
* @param txt code/name/tags query
* @returns matches [{code, name, tags}]
* @example
* ```javascript
* columns('vitamin c');
* columns('c-vitamin');
* // [ { code: 'vitc',
* // name: 'Total Ascorbic acid',
* // tags: 'ascorbate water soluble vitamin c vitamin c essential' } ]
*
* columns('what is butyric acid?');
* columns('c4:0 stands for?');
* // [ { code: 'f4d0',
* // name: 'Butyric acid (C4:0)',
* // tags: 'c40 c 40 4 0 bta butanoic propanecarboxylic carboxylic saturated fatty fat triglyceride lipid colorless liquid unpleasant vomit body odor' } ]
* ```
*/
function columns(txt: string): [Column];
export = columns;