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

    Function isSimpleName

    • Determines whether a chemical name is "simple" enough to suggest to a user — an ordinary common name made only of letters and spaces, not a long IUPAC- or registry-style technical identifier.

      Parameters

      • name: string

        The candidate chemical name

      Returns boolean

      True if the name is short and contains only letters and spaces

      isSimpleName("acetone")                 // true
      isSimpleName("aspirin") // true
      isSimpleName("2-acetyloxybenzoic acid") // false (contains digits)
      export function isSimpleName(name: string): boolean {
      const trimmed = name.trim();
      if (trimmed.length < 3 || trimmed.length > 30) return false;
      return /^[A-Za-z][A-Za-z ]*$/.test(trimmed);
      }