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

    Function getCountryName

    • Resolves the full country name for a two-letter location code.

      Parameters

      • Optionallocation: string

        Two-letter country code (e.g. "US"); undefined yields undefined

      Returns undefined | string

      The full country name, or undefined when the code is missing/unknown

      getCountryName("US") // "United States"
      getCountryName("GB") // "United Kingdom"
      getCountryName(undefined) // undefined
      export function getCountryName(location?: string): string | undefined {
      if (!location) {
      return undefined;
      }
      return findCountryByIso2(location)?.name;
      }