1.2.10 • Published 6 months ago

req-country v1.2.10

Weekly downloads
59
License
MIT
Repository
github
Last release
6 months 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

6 months ago

1.2.10

6 months ago

1.2.8

8 months ago

1.2.7

1 year ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago