6.0.0 • Published 1 year ago

hmpo-countries-lib v6.0.0

Weekly downloads
55
License
MIT
Repository
github
Last release
1 year ago

hmpo-countries-lib

Country data API cache and wrapper library

Usage

const CountriesLib = require('hmpo-countries-lib');

let redisFactory = {
    getClient() {
        return redisInstance;
    }
}

let countriesLib = new CountriesLib({
    store: redisFactory,
    key: 'store-key-prefix',
    storeInterval: 10000, // 10 seconds
    countryUrl: 'http://example.com/api/countries',
    countryInterval: 3000000 // 5 minutes
});

// start polling
countriesLib.start();
let allCountries = countriesLib.getAllCountries();
let residentCountries = countriesLib.getResidentCountries();
let overseasCountries = countriesLib.getOverseasCountries();
let overseasResidenceCountries = countriesLib.getOverseasResidenceCountries();
let overseasBirthCountries = countriesLib.getOverseasBirthCountries();
let birthCountries = countriesLib.getBirthCountries();
let countryData = countriesLib.getCountryDataById('GB');
let countryData = countriesLib.getCountryDataBySlug('united-kingdom');
let countryData = countriesLib.getCountryByDisplayName('United Kingdom');
// stop polling
countriesLib.stop();
6.0.0

1 year ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.0

5 years ago

2.3.0

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago