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

    Module helpers/productIdentity

    Functions - Helpers

    getProductIdentityKey

    Derive the stable per-product cache/exclusion key from a supplier-defined identity and the supplier name. Both the product-detail cache (SupplierCache.getProductIdentityCacheKey) and the exclusion store (addExcludedProduct) route through this one function, so a product's cache entry and its exclusion entry share the same key by construction.

    getProductDedupeKey

    Derive a supplier-scoped dedupe key for a product, used to drop the same product appearing more than once in a single search's result set. Prefers the supplier-stable cacheKey, then id, uuid, and finally url, all mixed with the supplier name so two suppliers that share an identity string (e.g. a numeric id like 6981) never collide. Returns undefined when the product carries no usable identity, so callers keep it rather than merging unknowns.

    dedupeProducts

    Remove duplicate products from a result set, keeping the first occurrence of each identity as determined by getProductDedupeKey. Products with no usable identity are always kept (never merged with each other). Order is preserved.