iso-3166-1
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -30,3 +30,10 @@ import { Country } from './iso-3166'; | ||
export declare const whereNumeric: (numeric: string | number) => Country | undefined; | ||
/** | ||
* Get all countries. | ||
* | ||
* @returns {Array<Country>} | ||
*/ | ||
export declare const all: () => Country[]; | ||
declare const _default: { | ||
all: () => Country[]; | ||
whereCountry: (name: string) => Country | undefined; | ||
@@ -33,0 +40,0 @@ whereAlpha2: (alpha2: string) => Country | undefined; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.whereNumeric = exports.whereAlpha3 = exports.whereAlpha2 = exports.whereCountry = void 0; | ||
exports.all = exports.whereNumeric = exports.whereAlpha3 = exports.whereAlpha2 = exports.whereCountry = void 0; | ||
const iso_3166_1 = __importDefault(require("./iso-3166")); | ||
@@ -45,3 +45,10 @@ /** | ||
}; | ||
/** | ||
* Get all countries. | ||
* | ||
* @returns {Array<Country>} | ||
*/ | ||
exports.all = () => iso_3166_1.default; | ||
exports.default = { | ||
all: exports.all, | ||
whereCountry: exports.whereCountry, | ||
@@ -48,0 +55,0 @@ whereAlpha2: exports.whereAlpha2, |
{ | ||
"name": "iso-3166-1", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -75,3 +75,20 @@ # iso-3166-1 | ||
Get all countries | ||
```javascript | ||
const iso = require('iso-3166-1'); | ||
console.log(iso.all()); | ||
/** Returns: | ||
[ | ||
{ | ||
country: 'Norway', | ||
alpha2: 'NO', | ||
alpha3: 'NOR', | ||
numeric: '578' | ||
} | ||
] | ||
*/ | ||
``` | ||
### License | ||
MIT © [Daniel Eckermann](http://danieleckermann.com) |
@@ -0,6 +1,12 @@ | ||
import { expect } from 'chai'; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
import iso from '../src/'; | ||
import countries from '../src/iso-3166'; | ||
describe('ISO-3166 test suite', function () { | ||
it('returns an array of all countries', function() { | ||
expect(iso.all()).to.be.equal(countries); | ||
}); | ||
it('returns a country by alpha-2 with lowercase letters', function () { | ||
@@ -7,0 +13,0 @@ const deepObject = iso.whereAlpha2('no'); |
38066
1679
93