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

    Function extractSolubility

    • Parses a PUG-View Solubility response into de-duplicated plain-text statements.

      Parameters

      • data: unknown

        The parsed JSON response body

      Returns undefined | string[]

      Up to five distinct solubility statements, or undefined when none exist

      export function extractSolubility(data: unknown): string[] | undefined {
      const lines = new Set<string>();
      for (const entry of collectInformation(data)) {
      for (const { text } of markupItems(entry)) {
      const trimmed = text.trim();
      if (trimmed !== '') lines.add(trimmed);
      }
      }
      return lines.size > 0 ? [...lines].slice(0, 5) : undefined;
      }