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

    Function countriesForSuppliers

    • The distinct home countries of the given suppliers. Used to decide which country options are still reachable: a country no selected supplier resides in can be disabled. Empty in ⇒ empty out (no supplier constraint).

      Parameters

      • meta: SupplierMetaMap

        Supplier shipping/country metadata.

      • suppliers: readonly string[]

        The currently selected supplier class names.

      Returns Set<valueof<any>>

      The set of country codes those suppliers reside in.

      countriesForSuppliers(
      { A: { country: 'US', shipping: 'domestic' }, B: { country: 'DE', shipping: 'international' } },
      ['B'],
      ); // => Set { 'DE' }
      export function countriesForSuppliers(
      meta: SupplierMetaMap,
      suppliers: readonly string[],
      ): Set<CountryCode> {
      const countries = new Set<CountryCode>();
      for (const key of suppliers) {
      const entry = meta[key];
      if (entry) countries.add(entry.country);
      }
      return countries;
      }