UNPKG

pubchem

Version:

pubchem simplifies the data retrieval from the PubChem API.

24 lines (19 loc) 694 B
import { parseNumbersUnits } from 'physical-parser'; import type { Options } from '../../compound/Compound'; import type { DataType } from '../CompoundData'; import { extractExperimentalData } from './extractExperimentalData'; /** * Returns the melting point of a compound * @param data Data of a compound data request to the PubChem API * @param options Options for the compound * @returns ExperimentalData */ export function getMeltingPoint( data: DataType, options: Pick<Options, 'temperature'> = {}, ) { const meltingPoint = extractExperimentalData(data, 'Melting Point', { parser: (value) => parseNumbersUnits(value, options.temperature), }); return meltingPoint; }