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

    Function getCompoundNameFromAlias

    • Get the compound name from a synonym.

      Parameters

      • cmpdsynonym: string

        The synonym to get the compound name from.

      Returns Promise<undefined | string>

      The compound name from the synonym.

      const cmpd = await getCompoundNameFromAlias("2-Acetoxybenzenecarboxylic acid");
      console.log(cmpd);
      // Outputs: Aspirin
      export async function getCompoundNameFromAlias(cmpdsynonym: string): Promise<string | undefined> {
      const searchResult = await executeSDQSearch({
      where: { cmpdsynonym },
      select: ["cid", "cmpdname", "iupacname"],
      limit: 1,
      });

      if (!searchResult) {
      return undefined;
      }

      return searchResult[0].cmpdname;
      }