Skip to content

Commit 302cf85

Browse files
Nick59Nick
andauthored
Mapbox: add country code to properties when available (#278)
Co-authored-by: Nick <nick@binariesworld.com>
1 parent b8ebba1 commit 302cf85

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/geocoders/mapbox.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export var Mapbox = L.Class.extend({
4949
for (var j = 0; j < (loc.context || []).length; j++) {
5050
var id = loc.context[j].id.split('.')[0];
5151
properties[id] = loc.context[j].text;
52+
53+
// Get country code when available
54+
if (loc.context[j].short_code) {
55+
properties['countryShortCode'] = loc.context[j].short_code
56+
}
5257
}
5358

5459
results[i] = {

0 commit comments

Comments
 (0)