labelSchema.js
function getUSADependencyOrCountryValue(record) {
  if ('dependency' === record.layer && !_.isEmpty(record.dependency)) {
    return record.dependency[0];
  } else if ('country' === record.layer && !_.isEmpty(record.country)) {
    return record.country[0];
  }

  if (!_.isEmpty(record.dependency_a)) {
    return record.dependency_a[0];
  } else if (!_.isEmpty(record.dependency)) {
    return record.dependency[0];
  }

  return record.country_a[0];
}
function getUSADependencyOrCountryValue(record) {
  if ('dependency' === record.layer && !_.isEmpty(record.dependency)) {
    return record.dependency[0];
  } else if ('country' === record.layer && !_.isEmpty(record.country)) {
    return record.country[0];
  }

  if (!_.isEmpty(record.dependency_a)) {
    return record.dependency_a[0];
  } else if (!_.isEmpty(record.dependency)) {
    return record.dependency[0];
  }

  return record.country_a[0];
}
function getUSADependencyOrCountryValue ( record ) { if ( 'dependency' === record . layer && ! _ . isEmpty ( record . dependency ) ) { return record . dependency [ 0 ] ; } else if ( 'country' === record . layer && ! _ . isEmpty ( record . country ) ) { return record . country [ 0 ] ; } if ( ! _ . isEmpty ( record . dependency_a ) ) { return record . dependency_a [ 0 ] ; } else if ( ! _ . isEmpty ( record . dependency ) ) { return record . dependency [ 0 ] ; } return record . country_a [ 0 ] ; }
this function generates the last field of the labels for US records 1.  use dependency name if layer is dependency, eg - Puerto Rico 2.  use country name if layer is country, eg - United States 3.  use dependency abbreviation if applicable, eg - San Juan, PR 4.  use dependency name if no abbreviation, eg - San Juan, Puerto Rico 5.  use country abbreviation, eg - Lancaster, PA, USA
this function generates the last field of the labels for US records 1 . use dependency name if layer is dependency eg - Puerto Rico 2 . use country name if layer is country eg - United States 3 . use dependency abbreviation if applicable eg - San Juan PR 4 . use dependency name if no abbreviation eg - San Juan Puerto Rico 5 . use country abbreviation eg - Lancaster PA USA