-
Notifications
You must be signed in to change notification settings - Fork 0
load
Subhajit Sahu edited this page Feb 10, 2020
·
3 revisions
Preloads food additive data (before use).
Doing this ahead of time, prevents 1st query being slow.
foodins.load();
// --> true
const foodins = require('food-ins');
foodins.load();
/* corpus loaded */
// true
foodins('102');
/* 1st query does not need to load (fast) */
// [ { code: '102',
// names: 'tartrazine',
// type: 'colour (yellow and orange) (FDA: FD&C Yellow #5)',
// status: 'a e' } ]
foodins('101 a');
/* further queries are always fast */
// [ { code: '102',
// names: 'tartrazine',
// type: 'colour (yellow and orange) (FDA: FD&C Yellow #5)',
// status: 'a e' } ]