ChemPal Documentation - v1.6.0
    Preparing search index...

    Variable getCidByFormulaConst

    getCidByFormula: (formula: string) => Promise<PubChemCID | undefined> = ...

    Resolves a molecular formula to its best-matching PubChem CID via the PUG-REST fastformula search (the plain name endpoint 404s on most formulas). Returns the first CID PubChem reports. Cached for three days.

    Type declaration

      • (formula: string): Promise<PubChemCID | undefined>
      • Parameters

        • formula: string

          The molecular formula to look up (e.g. "Na6O18P6")

        Returns Promise<PubChemCID | undefined>

        The best-matching CID, or undefined if PubChem has no match

    await getCidByFormula("Na6O18P6"); // 24968
    
    export const getCidByFormula: (formula: string) => Promise<PubChemCID | undefined> = withTtlCache(
    getCidByFormulaUncached,
    { namespace: 'cidByFormula' },
    );