The candidate chemical name
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);
}
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.