-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
60 lines (52 loc) · 1.74 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
57
58
59
60
export interface Carbohydrate {
/** S. No. */
sno: string,
/** Carbohydrate. */
carbohydrate: string,
/** Equivalent after Hydrolysis (g/100g). */
hydrolysis: number,
/** Conversion to monosaccharide equivalent. */
monosaccharide: number
}
/**
* Loads corpus to enable queries.
* [📦](https://www.npmjs.com/package/@ifct2017/carbohydrates)
* @returns corpus {sno ⇒ {sno, carbohydrate, hydrolysis, monosaccharide}}
*/
export function load() : Map<string, Carbohydrate>;
/**
* Generates PostgreSQL statements for creating table w/ data.
* [📦](https://www.npmjs.com/package/@ifct2017/carbohydrates)
* @returns CREATE TABLE, INSERT, CREATE VIEW, CREATE INDEX statements
*/
export function sql(tab: string='carbohydrates', opt: object={}) : string;
/**
* Gives path of CSV data file.
* [📦](https://www.npmjs.com/package/@ifct2017/carbohydrates)
* @returns .../index.csv
*/
export function csv() : string;
/**
* Finds matching carbohydrates of an sno/carbohydrate query.
* [📦](https://www.npmjs.com/package/@ifct2017/carbohydrates)
* @param txt sno/carbohydrate query
* @returns matches [{sno, carbohydrate, hydrolysis, monosaccharide}]
* @example
* ```javascript
* carbohydrates('monosaccharide');
* carbohydrates('Glucose');
* // [ { sno: '1',
* // carbohydrate: 'Monosaccharides e.g. glucose',
* // hydrolysis: 100,
* // monosaccharide: 1 } ]
*
* carbohydrates('what is carbohydrate conversion factor of disaccharides?');
* carbohydrates('maltose conversion factor');
* // [ { sno: '2',
* // carbohydrate: 'Disaccharides e.g. sucrose, lactose, maltose',
* // hydrolysis: 105,
* // monosaccharide: 1.05 } ]
* ```
*/
function carbohydrates(txt: string): [Carbohydrate];
export = carbohydrates;