ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function getIUPACName

    • Gets the IUPAC name of a chemical from the Cactus API.

      Parameters

      • name: string

        The name of the chemical to get the IUPAC name of

      Returns Promise<Maybe<string>>

      The IUPAC name of the chemical

      export async function getIUPACName(name: string): Promise<Maybe<string>> {
      const response = await fetch(
      `https://cactus.nci.nih.gov/chemical/structure/${encodeURIComponent(name)}/iupac_name`,
      );
      const data = await response.text();
      if (!data) return;
      return data.trim();
      }