Package Exports
- @ifct2017/codes
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ifct2017/codes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@ifct2017/codes
Food codes from food name in Indian Food Composition Tables 2017.
Check available food codes.
Large corpus is not loaded synchronously.
Load it asynchronously with .load().
const codes = require('@ifct2017/codes');
// codes.corpus: Map {name => {name, code}}
// codes.load(): Promise (corpus loaded)
// codes.sql([table], [options]): Promise (sql commands)
// codes.csv(): path to csv file
// codes(<query>)
// -> [{name, code}] for matched food names
await codes.load();
/* load corpus first */
codes('mango green');
codes('Raw mango');
// [ { name: 'Mango, green, raw (Common)', code: 'D057' } ]
codes('what is food code of atta?');
codes('atta code');
// [ { name: 'Atta (H., P.)', code: 'A019' },
// { name: 'Gahama atta (O.)', code: 'A019' },
// { name: 'Wheat flour, atta (Common)', code: 'A019' } ]