1const DEFAULT_COUNTRY_CODE_BY_HOST = Object.freeze({ 2 be: 'BE', 3 de: 'DE', 4 es: 'ES', 5 eu: 'DE', 6 fr: 'FR', 7 nl: 'NL', 8 pl: 'PL', 9 se: 'SE', 10 si: 'SI', 11}); 12 13const getDefaultCountryCode = (host) => { 14 const normalizedHost = String(host || '') 15 .trim() 16 .toLowerCase(); 17 return DEFAULT_COUNTRY_CODE_BY_HOST[normalizedHost] || 'DE'; 18}; 19 20const getDefaultCountryId = (countries, host) => { 21 const entries = Array.isArray(countries) ? countries : []; 22 const defaultCountryCode = getDefaultCountryCode(host); 23 const match = entries.find( 24 (country) => 25 String(country?.countryCode || '') 26 .trim() 27 .toUpperCase() === defaultCountryCode, 28 ); 29 return String(match?.id || entries[0]?.id || ''); 30}; 31 32export { DEFAULT_COUNTRY_CODE_BY_HOST, getDefaultCountryCode, getDefaultCountryId };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.