Skip to content

Commit 23f9a0f

Browse files
committed
Merge branch 'release-1.0.3'
2 parents d1bc1a2 + 0930cd2 commit 23f9a0f

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,20 @@ angular.module('myApp')
3131
console.log(ISO3166.getCountryName('FR'));
3232
// FRANCE
3333

34+
// Get several country names at once (ignores invalid codes)
35+
console.log(ISO3166.getCountryNames(['DE', 'FR', 'invalid']);
36+
// {
37+
// 'DE': 'GERMANY',
38+
// 'FR': 'FRANCE'
39+
// }
40+
3441
// Direct access to the data
3542
console.log(ISO3166.codeToCountry);
3643
// {
3744
// 'FR': 'FRANCE',
3845
// ...
3946
// }
47+
4048
});
4149
```
4250

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "iso-3166-country-codes-angular",
3-
"version": "1.0.2",
4-
"main": "dist/iso-3166-country-codes-angular.js",
3+
"version": "1.0.3",
4+
"main": "dist/iso-3166-country-codes-angular.min.js",
55
"ignore": [
66
"**/.*",
77
"node_modules",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iso-3166-country-codes-angular",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "An AngularJS module to work with Country Codes",
55
"repository": {
66
"type": "git",
@@ -20,7 +20,7 @@
2020
"devDependencies": {
2121
"grunt": "~0.4.1",
2222
"grunt-contrib-uglify": "~0.2.2",
23-
"grunt-contrib-jshint": "~0.6.0"
23+
"grunt-contrib-jshint": "~0.7.1"
2424
},
2525
"engines": {
2626
"node": ">=0.8.0"

src/iso-3166-country-codes-angular.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,24 @@ angular.module('iso-3166-country-codes', [])
256256
'ZW': 'ZIMBABWE'
257257
};
258258

259-
holder.isCountryCode = function (input) {
259+
holder.isCountryCode = function(input) {
260260
return angular.isDefined(this.codeToCountry[input]);
261261
};
262262

263263
holder.getCountryName = function(countryCode) {
264264
return this.codeToCountry[countryCode];
265265
};
266266

267+
holder.getCountryNames = function(countryCodes) {
268+
var countries = {};
269+
angular.forEach(countryCodes, function(key) {
270+
if (holder.isCountryCode(key)) {
271+
countries[key] = holder.getCountryName(key);
272+
}
273+
});
274+
return countries;
275+
};
276+
267277
return holder;
268278
})
269279
.filter('isoCountry', ['ISO3166', function(ISO3166){

0 commit comments

Comments
 (0)