CircleCI License: GPL v3

scala-iso

Scala library for ISO enums

Maven Central

libraryDependencies += "io.bartholomews" %% "scala-iso" % "0.1.0"

ISO 3166-1 alpha-2

CountryCodeAlpha2 are StringCirceEnums (using enumeratum with circe codecs on the two-digits ISO string)

  import io.bartholomews.iso_country.CountryCodeAlpha2
  import io.circe._
  import io.circe.syntax._

  val italy: CountryCodeAlpha2 = CountryCodeAlpha2.ITALY
  
  assert(italy.asJson == Json.fromString("IT"))
  assert("IT".asJson.as[CountryCodeAlpha2].map(_.name) == Right("Italy"))