Created
December 3, 2017 16:35
-
-
Save nderkach/88627d0cdf8d347a2df5949ee7285511 to your computer and use it in GitHub Desktop.
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
| function getCountry(addrComponents) { | |
| var address = {}; | |
| for (var i = 0; i < addrComponents.length; i++) { | |
| if (addrComponents[i].types[0] == "country") { | |
| address["country_short"] = addrComponents[i].short_name; | |
| address["country"] = addrComponents[i].long_name; | |
| } | |
| if (addrComponents[i].types[0] == "locality") { | |
| address["city"] = addrComponents[i].long_name; | |
| } | |
| } | |
| return address; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment