Skip to content

Instantly share code, notes, and snippets.

@justlaputa
Last active June 1, 2016 14:22
Show Gist options
  • Save justlaputa/b669e1e9bd4a523175b896a02cc43bdf to your computer and use it in GitHub Desktop.
Save justlaputa/b669e1e9bd4a523175b896a02cc43bdf to your computer and use it in GitHub Desktop.
parse japanese country name to iso-3166-2 code: http://www.asahi-net.or.jp/~ax2s-kmtn/ref/iso3166-1.html
var codes = []
$('table.basic>tbody tr td[lang="en"]').each(function(i) {
td = $(this)
en_name = td.text()
siblings = td.siblings()
ja_name = siblings.get(0).textContent
iso_3166_2_code = siblings.get(1).textContent
codes.push({
iso_3166_2: iso_3166_2_code,
name: {
'en': en_name,
'ja': ja_name
}
})
})
console.log(JSON.stringify(codes))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment