ChemPal Documentation - v1.17.0
    Preparing search index...
    • Type guard for the window.Searchanise object that Searchanise-powered storefronts embed in their pages. Requires a non-empty host string and a 10-character alphanumeric api_key; other fields are ignored.

      Parameters

      • data: unknown

        The value to validate (typically parsed from the storefront's homepage)

      Returns data is SearchaniseApiObject

      Type predicate indicating whether the value carries a usable host and api_key

      isValidSearchaniseApiObject({ host: 'https://searchserverapi1.com', api_key: '4p4M0R6q0N' });
      // true
      isValidSearchaniseApiObject({ host: 'https://searchserverapi1.com', api_key: 'short' });
      // false
      export function isValidSearchaniseApiObject(data: unknown): data is SearchaniseApiObject {
      return v.safeParse(searchaniseApiObjectSchema, data).success;
      }