-
Notifications
You must be signed in to change notification settings - Fork 3
load
Subhajit Sahu edited this page Feb 10, 2020
·
1 revision
Preloads food additive data (before use).
Doing this ahead of time, prevents 1st query being slow.
foode.load();
// --> true
const foode = require('food-e');
foode.load();
/* corpus loaded */
// true
foode('E101a');
/* 1st query does not need to load (fast) */
// [ { code: 'E101a',
// names: 'Riboflavin-5\'-Phosphate',
// type: 'color (Yellow-orange)',
// status: 'e' } ]
foode('101 a');
/* further queries are always fast */
// [ { code: 'E101a',
// names: 'Riboflavin-5\'-Phosphate',
// type: 'color (Yellow-orange)',
// status: 'e' } ]