Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hmpo-countries-lib

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hmpo-countries-lib

Country lists

  • 7.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

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();

FAQs

Package last updated on 22 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc