UNPKG

pubchem

Version:

pubchem simplifies the data retrieval from the PubChem API.

26 lines 885 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getReferences = getReferences; const jsonpath_1 = __importDefault(require("jsonpath")); /** * Returns all references cited in the PubChem entry * * @param data Data of a compound data request to the PubChem API * @returns References */ function getReferences(data) { const references = jsonpath_1.default.query(data, '$.Reference[*]').reduce((ref, entry) => { ref[entry.ReferenceNumber] = { url: entry.URL, sourceName: entry.SourceName, name: entry.Name, description: entry.Description, }; return ref; }, {}); return references; } //# sourceMappingURL=getReferences.js.map