A chemical name or CAS number.
The matching record, or undefined when OBIS has none or is unavailable.
await lookupOshaChemical('67-64-1'); // { name: "ACETONE", nfpaHealth: "1", ... }
await lookupOshaChemical('hydroxide sodium'); // { name: "SODIUM HYDROXIDE", ... }
export async function lookupOshaChemical(term: string): Promise<OshaChemical | undefined> {
const index = await loadOshaIndex();
if (index === undefined) return undefined;
const trimmed = term.trim();
if (isCAS(trimmed)) return index.byCas.get(trimmed);
const key = normalizeChemicalName(trimmed);
return index.byName.get(key) ?? index.byTokens.get(key.split(' ').sort().join(' '));
}
Looks a searched term up in the OSHA OBIS dataset by CAS number, exact name/synonym, or the same words in any order (so "hydroxide sodium" still finds "sodium hydroxide").