pubchem
Version:
pubchem simplifies the data retrieval from the PubChem API.
38 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNumberProperties = getNumberProperties;
const getComputedDataSection_1 = require("./getComputedDataSection");
const getComputedPropertySection_1 = require("./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
*/
function getNumberProperties(data, sectionName) {
const output = {
value: null,
label: null,
reference: {
description: null,
},
description: null,
};
try {
const computationalData = (0, getComputedDataSection_1.getComputedDataSection)(data);
const section = (0, getComputedPropertySection_1.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