Skip to content

Commit ee7de47

Browse files
committed
trim country name string before regex test
- to extract sure (!) - as by design, the country name regex don't strip leading or trailing whitespaces see: vincentarelbundock/countrycode#134 (comment)
1 parent 36b82a6 commit ee7de47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/geo_location_utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function countryNameToISO3(countryName) {
5151
var iso3 = countryIds[i],
5252
regex = new RegExp(countryRegex[iso3]);
5353

54-
if(regex.test(countryName.toLowerCase())) return iso3;
54+
if(regex.test(countryName.trim().toLowerCase())) return iso3;
5555
}
5656

5757
Lib.warn('Unrecognized country name: ' + countryName + '.');

0 commit comments

Comments
 (0)