@@ -247,7 +247,7 @@ async function renderHomePage(context) {
247247 <div class="list-row">
248248 <div>
249249 <strong>${ escapeHtml ( item . asnName || `AS${ item . asnId } ` ) } </strong>
250- <small>AS${ formatInteger ( item . asnId ) } · ${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } · ${ escapeHtml ( formatAsnTypeLabel ( item . asnType || 'unknown' ) ) } </small>
250+ <small>AS${ formatInteger ( item . asnId ) } · ${ flag ( item . countryIso ) } ${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } · ${ escapeHtml ( formatAsnTypeLabel ( item . asnType || 'unknown' ) ) } </small>
251251 </div>
252252 <div class="list-metric">
253253 <strong>${ formatInteger ( item . prefixCount ) } </strong>
@@ -262,7 +262,7 @@ async function renderHomePage(context) {
262262 countryNode . innerHTML = topCountries . map ( item => `
263263 <div class="list-row">
264264 <div>
265- <strong>${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } </strong>
265+ <strong>${ flag ( item . countryIso ) } ${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } </strong>
266266 <small>${ escapeHtml ( item . countryIso || 'N/A' ) } · ${ formatInteger ( item . asnCount ) } ASNs</small>
267267 </div>
268268 <div class="list-metric">
@@ -373,7 +373,7 @@ async function renderCoveragePage(context) {
373373 return `
374374 <tr class="coverage-table-row" tabindex="0" role="button" data-coverage-iso="${ iso } " aria-label="Focus ${ escapeHtml ( item . countryName || item . iso2 || 'country' ) } on the map">
375375 <td>
376- <strong>${ escapeHtml ( item . countryName || item . iso2 || 'Unknown' ) } </strong>
376+ <strong>${ flag ( item . iso2 ) } ${ escapeHtml ( item . countryName || item . iso2 || 'Unknown' ) } </strong>
377377 <div class="table-subtext">${ escapeHtml ( item . topAsnName || 'Leading ASN unavailable' ) } </div>
378378 </td>
379379 <td>${ escapeHtml ( item . iso2 || 'N/A' ) } </td>
@@ -423,7 +423,7 @@ async function renderCoveragePage(context) {
423423 leadersNode . innerHTML = concentrationLeaders . map ( item => `
424424 <div class="list-row">
425425 <div>
426- <strong>${ escapeHtml ( item . countryName || item . iso2 || 'Unknown' ) } </strong>
426+ <strong>${ flag ( item . iso2 ) } ${ escapeHtml ( item . countryName || item . iso2 || 'Unknown' ) } </strong>
427427 <small>${ escapeHtml ( item . iso2 || 'N/A' ) } · ${ escapeHtml ( item . topAsnName || 'No dominant ASN' ) } · ${ formatInteger ( item . asnCount ) } ASNs</small>
428428 </div>
429429 <div class="list-metric">
@@ -443,7 +443,7 @@ async function renderCoveragePage(context) {
443443 laggardsNode . innerHTML = leastConcentrated . map ( item => `
444444 <div class="list-row">
445445 <div>
446- <strong>${ escapeHtml ( item . countryName || item . iso2 || 'Unknown' ) } </strong>
446+ <strong>${ flag ( item . iso2 ) } ${ escapeHtml ( item . countryName || item . iso2 || 'Unknown' ) } </strong>
447447 <small>${ escapeHtml ( item . iso2 || 'N/A' ) } · ${ escapeHtml ( item . topAsnName || 'No single dominant ASN' ) } · ${ formatInteger ( item . asnCount ) } ASNs</small>
448448 </div>
449449 <div class="list-metric">
@@ -1460,7 +1460,7 @@ async function renderAsnLandingPage(context) {
14601460 <div class="list-row">
14611461 <div>
14621462 <strong>${ escapeHtml ( item . asnName || `AS${ item . asnId } ` ) } </strong>
1463- <small>AS${ formatInteger ( item . asnId ) } · ${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } · ${ escapeHtml ( formatAsnTypeLabel ( item . asnType || 'unknown' ) ) } </small>
1463+ <small>AS${ formatInteger ( item . asnId ) } · ${ flag ( item . countryIso ) } ${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } · ${ escapeHtml ( formatAsnTypeLabel ( item . asnType || 'unknown' ) ) } </small>
14641464 </div>
14651465 <div class="list-metric">
14661466 <strong>${ formatInteger ( item . prefixCount ) } </strong>
@@ -1477,7 +1477,7 @@ async function renderAsnLandingPage(context) {
14771477 <div class="list-row">
14781478 <div>
14791479 <strong>${ escapeHtml ( item . asnName || `AS${ item . asnId } ` ) } </strong>
1480- <small>AS${ formatInteger ( item . asnId ) } · ${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } · ${ escapeHtml ( formatAsnTypeLabel ( item . asnType || 'unknown' ) ) } </small>
1480+ <small>AS${ formatInteger ( item . asnId ) } · ${ flag ( item . countryIso ) } ${ escapeHtml ( item . countryName || item . countryIso || 'Unknown' ) } · ${ escapeHtml ( formatAsnTypeLabel ( item . asnType || 'unknown' ) ) } </small>
14811481 </div>
14821482 <div class="list-metric">
14831483 <strong>${ formatInteger ( item . prefixCount ) } </strong>
@@ -2053,6 +2053,13 @@ function getItems(value) {
20532053 return [ ] ;
20542054}
20552055
2056+ // Inline flag <span> from an ISO 3166-1 alpha-2 code (flag-icons CSS classes).
2057+ // Returns '' for missing/invalid codes so non-country values degrade gracefully.
2058+ function flag ( iso2 ) {
2059+ const c = String ( iso2 == null ? '' : iso2 ) . trim ( ) . toLowerCase ( ) ;
2060+ return / ^ [ a - z ] { 2 } $ / . test ( c ) ? `<span class="fi fi-${ c } " aria-hidden="true"></span> ` : '' ;
2061+ }
2062+
20562063function getItemCount ( value ) {
20572064 return getItems ( value ) . length ;
20582065}
0 commit comments