Skip to main content
Home

Built and signed on GitHub Actions

Kit for International Network of Food Data Systems (INFOODS).

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
2 days ago (0.3.8)

Kit for International Network of Food Data Systems (INFOODS).

This package provides utilities for accessing standardized food composition data, including abbreviation resolution (e.g., expanding GLVs to Green Leafy Vegetables) and nutrient tagname lookups (e.g., mapping vitamin C to its INFOODS code VITC), with functions to load datasets, generate SQL/CSV schemas, and query terms through flexible pattern matching.

▌ 📦 JSR, 📰 Docs.


import * as infoods from "jsr:@nodef/infoods";
// infoods.loadAbbreviations(): Map {key => {abbr, full}}
// infoods.abbreviationsSql([table], [options]): SQL commands to create abbreviations table
// infoods.abbreviationsCsv(): Path to csv file
// infoods.abbreviations(<query>)
// → {abbr, full} if supported, null otherwise.


await infoods.loadAbbreviations();
// Load corpus first

infoods.abbreviations('GLVs');
infoods.abbreviations('g l v s');
// → Green Leafy Vegetables

infoods.abbreviations('what is D.R.I.');
infoods.abbreviations('d. r. i. stands for?');
/* (full stops must immediately follow character, if present) */
/* (for single character abbreviations, full stop is mandatory) */
// → Dietary reference intake
import * as infoods from "jsr:@nodef/infoods";
// infoods.loadTagnames(): Map {code => {code, name, synonyms, unit, tables, comments, examples}}
// infoods.tagnamesSql([table], [options]): SQL commands to create tagnames table
// infoods.tagnamesCsv(): Path to csv file
// infoods.tagnames(<query>)
// → [{code, name, synonyms, unit, tables, comments, examples}] for matched tagnames


await infoods.loadTagnames();
// Load corpus first

infoods.tagnames('vitamin c');
infoods.tagnames('c-vitamin');
// → [
// →   {
// →     code: 'VITC',
// →     name: 'vitamin C',
// →     synonyms: 'ascorbic acid; ascorbate (Note that these terms are not true synonyms but are often found in food tables to refer to vitamin C.)',
// →     unit: 'mg',
// →     tables: 'USDA 401, SFK, MW, ETH, IND, NE, EA, PRC, DAN',
// →     comments: 'L-ascorbic acid plus L- dehydroascorbic acid.',
// →     examples: ''
// →   },
// →   ...
// → ]


infoods.tagnames('what is butyric acid?');
infoods.tagnames('c4:0 stands for?');
// → [
// →   {
// →     code: 'F4D0F',
// →     name: 'fatty acid 4:0; expressed per quantity of total fatty acids',
// →     synonyms: 'butyric acid; tetranoic acid',
// →     unit: 'g/100 g fatty acid',
// →     tables: 'MW, FRN, DAN, SWD',
// →     comments: '',
// →     examples: ''
// →   },
// →   ...
// → ]

License

As of 18 April 2025, this project is licensed under AGPL-3.0. Previous versions remain under MIT.





ORG

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@nodef/infoods

Import symbol

import * as infoods from "@nodef/infoods";
or

Import directly with a jsr specifier

import * as infoods from "jsr:@nodef/infoods";

Add Package

pnpm i jsr:@nodef/infoods
or (using pnpm 10.8 or older)
pnpm dlx jsr add @nodef/infoods

Import symbol

import * as infoods from "@nodef/infoods";

Add Package

yarn add jsr:@nodef/infoods
or (using Yarn 4.8 or older)
yarn dlx jsr add @nodef/infoods

Import symbol

import * as infoods from "@nodef/infoods";

Add Package

npx jsr add @nodef/infoods

Import symbol

import * as infoods from "@nodef/infoods";

Add Package

bunx jsr add @nodef/infoods

Import symbol

import * as infoods from "@nodef/infoods";