@plentymarkets/shop-api / countryGetters
Variable: countryGetters ​
constcountryGetters:object
Defined in: getters/countryGetters.ts:94
Type Declaration ​
getCountryById ​
getCountryById: (
countries,countryId) =>Country|null
Finds a country by its numeric ID in a list of countries.
Parameters ​
countries ​
Country[]
The array of available countries.
countryId ​
string
The numeric or string ID of the country to find.
Returns ​
Country | null
The matching Country object, or null if not found or the list is empty.
getCountryId ​
getCountryId: (
country) =>string
Returns the numeric ID of a country as a string.
Parameters ​
country ​
The country object.
Returns ​
string
The country ID string, or an empty string if not set.
getCountryIsoCode ​
getCountryIsoCode: (
country) =>string
Returns the ISO 3166-1 alpha-2 country code.
Parameters ​
country ​
The country object.
Returns ​
string
The two-letter ISO code string (e.g. "DE"), or an empty string if not set.
getCountryName ​
getCountryName: (
country) =>string
Returns the display name of a country.
Parameters ​
country ​
The country object.
Returns ​
string
The country name string, or an empty string if not set.
getStateById ​
getStateById: (
country,stateId) =>State|null
Finds a state by its numeric ID within a country's state list.
Parameters ​
country ​
The country object containing the state list.
stateId ​
string
The numeric or string ID of the state to find.
Returns ​
State | null
The matching State object, or null if not found or the country has no states.
getStateId ​
getStateId: (
state) =>string
Returns the numeric ID of a state as a string.
Parameters ​
state ​
The state object.
Returns ​
string
The state ID string, or an empty string if not set.
getStateName ​
getStateName: (
state) =>string
Returns the display name of a state.
Parameters ​
state ​
The state object.
Returns ​
string
The state name string, or an empty string if not set.
getStates ​
getStates: (
country) =>State[]
Returns the list of states/regions for a country.
Parameters ​
country ​
The country object.
Returns ​
State[]
An array of State objects, or an empty array if none exist.