1.2.10 • Published 2 years ago

req-country v1.2.10

Weekly downloads
59
License
MIT
Repository
github
Last release
2 years ago

req-country

Last version NPM Status

Given a request, get the country associated with it. ISO 3166-1 alpha-2 compliant.

Install

$ npm install req-country --save

Usage

const requestCountry = require('req-country')

module.exports = (req, res) => {
  const country = requestCountry(req)

  console.log({ country })
  // => { country: 'ES' }
}

You can combine it with is-european and country-vat:

const { eeaMember, euMember } = require('is-european')
const requestCountry = require('req-country')
const countryVat = require('country-vat')

module.exports = (req, res) => {
  const country = requestCountry(req)

  console.log({ eeaMember: eeaMember(country), euMember: euMember(country) })
  // => { eeaMember: true, euMember: true }

  console.log(countryVat(country))
  // => 0.21
}

Related

  • is-european – Check if a country is part of the EU (European Union) or EEA (European Economic Area). ISO 3166-1 compliant.
  • country-vat – Given a request, get the country associated with it. ISO 3166-1 alpha-2 compliant.
  • tom.js.org – tom 🐶 is a backoffice for your projects.

License

req-country © Kiko Beats, released under the MIT License. Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · Twitter @Kikobeats

1.2.9

2 years ago

1.2.10

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago