ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...
    • Type guard to validate if a value is a full URL. Attempts to construct a URL object from the value.

      Parameters

      • val: unknown

        The value to validate

      Returns val is URL

      Type predicate indicating if the value is a valid URL

      isFullURL("https://www.google.com") // Returns true
      isFullURL("not a url") // Returns false
      export function isFullURL(val: unknown): val is URL {
      try {
      new URL(String(val));
      return true;
      } catch {
      return false;
      }
      }