Skip to content

pseinfo/hp-statements

Repository files navigation

GHS Hazard & Precautionary Statements

npm version License: MIT

Helper package for GHS Hazard (H), Precautionary (P) and EU-related (EUH) statements. This package provides a type-safe way to manage, validate, and translate GHS statements.

Primarily used for the periodic table database and pse-info.de.

Visit pseinfo.github.io/hp-statements to get a searchable list of all statements and translations.

Features

  • Type-safe: Full TypeScript support for all H, P, and EUH codes.
  • Fluent Factory: Easily build sets of statements with context.
  • Translator: Dynamic loading of translations in 24 languages.

Installation

npm install @pseinfo/hp-statements

Usage

Factory

Build a collection of statements:

import { HP } from '@pseinfo/hp-statements';

const statements = HP()
  .H( 'H200' ).EUH( 'EUH031' )
  .P( 'P101', { note: 'Substance is only hazardous when ...' } )
  .toObj();

Translator

Retrieve translations dynamically:

import { Translator } from '@pseinfo/hp-statements';

// Get a single translation
const text = await Translator.one( 'H200', 'de' );

// Get all translations for a code
const translations = await Translator.allOf( 'H200' );

// Get all statements for a language
const allFr = await Translator.all( 'fr' );

Assert

Validate codes:

import { Assert } from '@pseinfo/hp-statements';

Assert.isHCode( 'H200' ); // true
Assert.assertHCode( 'invalid' ); // Throws Error

Codes

Access codes directly from data directory:

import H201 from '@pseinfo/hp-statements/data/code/H/H201';

const text = H201.translations.en; // Explosive; mass explosion hazard.
const code = H201.code; // 'H201'

Also, the data/lang directory includes JSON files with all statements for each language.

Source

The data is obtained automatically via npm run fetch from the mhchem/hpstatements repository.

The data is licensed under CC BY 4.0.
Copyright © European Union, 1998-2025, CC BY 4.0.
Copyright © hpstatements contributors, 2019-2025, CC BY 4.0.

License

This project is licensed under the MIT License; see the LICENSE file for details.
Copyright © 2026 Periodic Table by Paul Köhler (komed3). All rights reserved.