JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34330
  • Score
    100M100P100Q151832F
  • License MIT

Privacy conscious EU detection browser library

Package Exports

  • @segment/in-eu
  • @segment/in-eu/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@segment/in-eu) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

🇪🇺 in-eu

Privacy conscious EU detection browser library

in-eu is a library for roughly detecting whether a website user is in the EU, without requiring a roundtrip to your server or a lookup against a GeoIP database.

It uses the browser's timezone (via the brilliant jstz and locale (navigator.languages) to infer whether someone is in the EU. in-eu trades absolute accuracy for a cautious approach that's more lightweight and respectful of end-user privacy.

Usage

$ npm install @segment/in-eu
import inEU from '@segment/in-eu'

inEU()
// => true | false

or try one of the more specific helpers:

import { isInEUTimezone } from '@segment/in-eu'

/*
 Only checks the browser timezone.
 Useful for checking if someone is physically present in the EU
*/

isInEUTimezone()
// => true | false
import { isEULocale } from '@segment/in-eu'

/*
 Only uses the browser's language/locale
 Useful for checking if someone speaks an european language accounting
 for locale. e.g. pt-PT (portuguese from Portugal)
*/

isEULocale()
// => true | false

License

in-eu is released under the MIT license.