New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

js-countries

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-countries

A Javascript library made for looking up countries based on string-input.

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

countries-js

A Javascript library made for looking up countries based on string-input. Originally made to ease the input of country names, but extended with a ton of info like population, phone extension, iso2/iso3 codes and so on. Data is not complete, so feel free to contribute if you find the missing pieces.

It's all very basic - only a single function is exposed, the countryLookup, which takes a string as input and returns the best match out of all the possibilities - weighted by population and things like whether the country name begins with the supplied string. The exact algorithm is a result of some trial-and-error. It's not perfect, but it works well, except for "Oman" where the algorithm insist you MUST mean "Romania". Ah well. Feel free to contribute here as well. I don't know anyone from Oman, so I've just pretended the problem isn't there, like a good little imperialist.

You can of course just use the countries.js file as-is and build your own stuff on top of it, but I'd prefer it if you contributed back to this tiny project.

Keywords

countries

FAQs

Package last updated on 14 Jan 2020

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