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

    Module utils/typeGuards/searchanise

    Functions - Typeguards

    isValidSearchResponse

    Type guard to validate if a response from the Searchanise search API is a valid SearchResponse object. Checks for the presence and correct types of all required properties including pagination info, suggestions, and a valid array of item listings.

    isSearchaniseVariant

    Type guard to validate if an object is a valid Searchanise product variant. Checks for the presence and correct types of all required variant properties including SKU, price, link, variant ID, quantity, and options.

    isItemListing

    Type guard to validate if an object is a valid Searchanise item listing. Checks for the presence and correct types of all required properties including product details, pricing, and an array of valid Searchanise variants.

    Suppliers - Typeguards

    isValidSearchaniseApiObject

    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.

    isSearchaniseCredentials

    Type guard for cached Searchanise credentials. Requires a 10-character alphanumeric apiKey and a non-empty host string. It checks shape only; the supplier separately checks the host against its allow-list before using it.