Static GeoIP utilities which accepts a 3166-1 alpha-2 country code and returns a JSON object with relevant Geographical information.
The vast majority of GeoIP services were doing too much or too little. We wanted a basic static powered GeoIP that would return exactly what we required in a fast and efficient manner. This project is composed from a series of small packages that map information from a series of datasets.
pnpm add @brixtol/i18n
npm install @brixtol/i18n
yarn add @brixtol/i18n
Pass in a currency code that is lowercase, uppercase or a mixture of both. There is 1 export available, the i18n
function exposes a mutate
option. When true
is passed then the function is curried. If you do not need to mutate the default response is returned.
The i18n response will return the following response (locale) information:
interface IGeoIP {
/**
* The 2 Letter country code
*/
countryCode: string;
/**
* The Country Name (in English)
*/
countryName: string;
/**
* The 3 letter Currency Code
*/
currencyCode: string;
/**
* The Currency Symbol
*/
currencySymbol: string;
/**
* The Currency Placement
*/
currencyPlacement: string;
}
import { i18n } from '@brixtol/i18n';
const default = geo('NL')
// => IGeoIP
const mutator = i18n('NL', { mutate: true})(locale => ({ ...locale, hello: 'hoi!' }))
// => IGeoIP & { hello: 'hoi!' }
This module constructs the response by using the following smaller modules:
- @brixtol/country-names
- @brixtol/currency-codes
- @brixtol/currency-placements
- @brixtol/currency-symbols
Licensed under MIT
We ♡ open source!