UNPKG

pubchem

Version:

pubchem simplifies the data retrieval from the PubChem API.

35 lines 1.13 kB
import { getComputedDataSection } from './getComputedDataSection'; import { getComputedPropertySection } from './getComputedPropertySection'; /** * Returns the number properties of a compound * * @param data Data of a compound data request to the PubChem API * @param sectionName Name of the section to get the data from * @returns Computed Data */ export function getNumberProperties(data, sectionName) { const output = { value: null, label: null, reference: { description: null, }, description: null, }; try { const computationalData = getComputedDataSection(data); const section = getComputedPropertySection(computationalData[0], sectionName); output.value = section.Value.Number[0]; output.label = sectionName; output.description = section.Description; output.reference.description = section.Reference[0]; if (section.Value.Unit) { output.units = section.Value.Unit; } } catch { /* empty */ } return output; } //# sourceMappingURL=getNumberProperties.js.map