Home / Function/ extractIso2FromFeatureProps() — supabase Function Reference

extractIso2FromFeatureProps() — supabase Function Reference

Architecture documentation for the extractIso2FromFeatureProps() function in geo.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/Reports/utils/geo.ts lines 102–126

export const extractIso2FromFeatureProps = (
  props?: Record<string, unknown>
): string | undefined => {
  if (!props) return undefined
  const candidates = [
    'ISO_A2_EH',
    'ISO_A2',
    'iso_a2',
    'ADMIN_ISO_A2',
    'WB_A2',
    'ADM0_A3_IS',
    'ADM0_A3',
    'ISO_N3',
    'id',
  ]
  for (const key of candidates) {
    const v = props[key] as unknown
    if (typeof v === 'string' && v.length === 2) return v.toUpperCase()
  }
  const name =
    (props['name'] as string | undefined) || (props['NAME'] as string | undefined) || undefined
  if (!name) return undefined
  const entry = COUNTRIES.find((c) => c.name === name)
  return entry?.code
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free