ChemPal Documentation - v1.6.0
    Preparing search index...
    • Type guard to validate if a value is an InChIKey. An InChIKey is three hyphen-separated uppercase-letter blocks of 14, 10, and 1 characters.

      Parameters

      • value: unknown

        The value to validate

      Returns value is InChIKey<string>

      Type predicate indicating if the value is a valid InChIKey

      isInChIKey("IRXRGVFLQOSHOH-UHFFFAOYSA-L") // Returns true
      isInChIKey("not-an-inchikey") // Returns false
      export function isInChIKey(value: unknown): value is InChIKey<string> {
      return typeof value === 'string' && /^[A-Z]{14}-[A-Z]{10}-[A-Z]$/.test(value);
      }