node-ipinfo
Advanced tools
Comparing version 3.5.1 to 3.5.2
{ | ||
"name": "node-ipinfo", | ||
"version": "3.5.1", | ||
"version": "3.5.2", | ||
"description": "Official Node client library for IPinfo", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -169,9 +169,6 @@ # [<img src="https://ipinfo.io/static/ipinfo-small.svg" alt="IPinfo" width="24"/>](https://ipinfo.io/) IPinfo NodeJS Client Library | ||
### Country Name Lookup | ||
### Internationalization | ||
`response.country` will return the country name, whereas `response.countryCode` can be used to fetch the country code. | ||
When looking up an IP address, the response object includes `response.country` will return the country name, `response.countryCode` can be used to fetch the country code, Additionally `response.isEU` will return `true` if the country is a member of the European Union (EU), `response.countryFlag` will return the emoji and Unicode of the country's flag, `response.countryFlagURL` will return a public link to the country's flag image as an SVG which can be used anywhere, `response.countryCurrency` will return the code and symbol of the country's currency and `response.continent` will return the continent of the IP. It is possible to return the country name in other languages, change the EU countries, countries flags, countries currencies, and continents by setting the `countries`, `euCountries`, `countriesFlags`, `countriesCurrencies` and `continents` settings when creating the IPinfo object. | ||
Additionally `response.isEU` will return `true` if the country is a member of the European Union (EU), `response.countryFlag` | ||
will return the emoji and Unicode of the country's flag, `response.countryFlagURL` will return a public link to the country's flag image as an SVG which can be used anywhere, `response.countryCurrency` will return the code and symbol of the country's currency and `response.continent` will return the continent of the IP. | ||
##### TypeScript | ||
@@ -182,4 +179,44 @@ | ||
const ipinfoWrapper = new IPinfoWrapper("MY_TOKEN"); | ||
const countries = { | ||
"US": "United States", | ||
"FR": "France", | ||
"BD": "Bangladesh", | ||
... | ||
} | ||
const countriesFlags = { | ||
"US": {"emoji": "🇺🇸","unicode": "U+1F1FA U+1F1F8"}, | ||
"AD": {"emoji": "🇦🇩", "unicode": "U+1F1E6 U+1F1E9"}, | ||
"AE": {"emoji": "🇦🇪", "unicode": "U+1F1E6 U+1F1EA"}, | ||
... | ||
} | ||
const countriesCurrencies = { | ||
"US" : { "code": "USD" ,"symbol": "$"}, | ||
"AD": {"code": "EUR", "symbol": "€"}, | ||
"AE": {"code": "AED", "symbol": "د.إ"}, | ||
... | ||
} | ||
const continents = { | ||
"US": {"code": "NA", "name": "North America"}, | ||
"BD": {"code": "AS", "name": "Asia"}, | ||
"BE": {"code": "EU", "name": "Europe"}, | ||
... | ||
} | ||
const euCountries = ["FR","ES","BE", ...] | ||
const ipinfoWrapper = new IPinfoWrapper( | ||
"MY_TOKEN", | ||
undefined, | ||
undefined, | ||
{ | ||
countries: countries, | ||
countriesFlags: countriesFlags, | ||
countriesCurrencies: countriesCurrencies, | ||
... | ||
} | ||
); | ||
ipinfoWrapper.lookupIp("1.1.1.1").then((response: IPinfo) => { | ||
@@ -214,4 +251,44 @@ // country code, e.g. 'US' | ||
const ipinfo = new IPinfoWrapper("MY_TOKEN"); | ||
const countries = { | ||
"US": "United States", | ||
"FR": "France", | ||
"BD": "Bangladesh", | ||
... | ||
} | ||
const countriesFlags = { | ||
"US": {"emoji": "🇺🇸","unicode": "U+1F1FA U+1F1F8"}, | ||
"AD": {"emoji": "🇦🇩", "unicode": "U+1F1E6 U+1F1E9"}, | ||
"AE": {"emoji": "🇦🇪", "unicode": "U+1F1E6 U+1F1EA"}, | ||
... | ||
} | ||
const countriesCurrencies = { | ||
"US" : { "code": "USD" ,"symbol": "$"}, | ||
"AD": {"code": "EUR", "symbol": "€"}, | ||
"AE": {"code": "AED", "symbol": "د.إ"}, | ||
... | ||
} | ||
const continents = { | ||
"US": {"code": "NA", "name": "North America"}, | ||
"BD": {"code": "AS", "name": "Asia"}, | ||
"BE": {"code": "EU", "name": "Europe"}, | ||
... | ||
} | ||
const euCountries = ["FR","ES","BE", ...] | ||
const ipinfo = new IPinfoWrapper( | ||
"MY_TOKEN", | ||
undefined, | ||
undefined, | ||
{ | ||
countries: countries, | ||
countriesFlags: countriesFlags, | ||
countriesCurrencies: countriesCurrencies, | ||
... | ||
} | ||
); | ||
ipinfo.lookupIp("1.1.1.1").then((response) => { | ||
@@ -218,0 +295,0 @@ // country code, e.g. 'US' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
433
25123
3
0
3