Last active
June 1, 2016 14:22
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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