-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
51 lines (43 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
export interface JonesFactor {
/** Food. */
food: string,
/** Conversion Factor. */
factor: number
}
/**
* Loads corpus to enable queries.
* [📦](https://www.npmjs.com/package/@ifct2017/jonesfactors)
* @returns corpus {food ⇒ {food, factor}}
*/
export function load() : Map<string, JonesFactor>;
/**
* Generates PostgreSQL statements for creating table w/ data.
* [📦](https://www.npmjs.com/package/@ifct2017/jonesfactors)
* @returns CREATE TABLE, INSERT, CREATE VIEW, CREATE INDEX statements
*/
export function sql(tab: string='jonesfactors', opt: object={}) : string;
/**
* Gives path of CSV data file.
* [📦](https://www.npmjs.com/package/@ifct2017/jonesfactors)
* @returns .../index.csv
*/
export function csv() : string;
/**
* Finds matching jones factors of a food query.
* [📦](https://www.npmjs.com/package/@ifct2017/jonesfactors)
* @param txt food query
* @returns matches [{food, factor}]
* @example
* ```javascript
* jonesFactors('maida');
* jonesFactors('Refined wheat');
* // [ { food: 'Refined wheat flour (Maida)', factor: '5.70' } ]
*
* jonesFactors('what is jones factor of barley?');
* jonesFactors('jones factor of oats');
* // [ { food: 'Barley and its flour;Rye and its flour;Oats',
* // factor: '5.83' } ]
* ```
*/
function jonesFactors(txt: string): [JonesFactor];
export = jonesFactors;