astrocite-eutils

Converts PubMed EUtils ESummary API Responses to CSL JSON

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
astrocite-eutils
1820.16.44 years ago7 years agoMinified + gzip package size for astrocite-eutils in KB

Readme

astrocite-eutils
A helper library for converting PubMed EUtils ESummary JSON to CSL JSON.
See astrocite for more details.

API

toCSL(apiResponse)

Returns: Array<CSL.Data | EUtilsError>
Where EUtilsError has the following interface
interface EUtilsError extends Error {
    /**
     * If the error occured on a single reference, then this is set with the identifier of that
     * reference
     */
    uid?: string;
    /**
     * True if the error is a global API-level error. Otherwise the Error occured on a single
     * reference (i.e, some of the request produced a valid result.)
     **/
    apiError: boolean;
}

apiResponse

Type: Object
The entire JSON response received from the PubMed EUtils ESummary API

Usage

import { toCSL } from 'astrocite-eutils';

// Assume apiResponse is the JSON received from the EUtils ESummary API
const cslJSON = toCSL(apiResponse);