@segment/in-eu
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@segment/in-eu", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Privacy conscious EU detection browser library", | ||
@@ -10,3 +10,3 @@ "keywords": ["gdpr", "europe", "timezone", "locale"], | ||
}, | ||
"author": "Netto Farah<netto@segment.com>", | ||
"author": "Netto Farah <netto@segment.com>", | ||
"license": "MIT", | ||
@@ -13,0 +13,0 @@ "dependencies": { |
@@ -6,3 +6,4 @@ # 🇪🇺 in-eu | ||
It uses the browser's timezone (via the brilliant [jstz](https://github.com/iansinnott/jstz) and locale (`navigator.languages`) to infer whether someone is in the EU. It trades absolute accuracy for a cautious approach that's more lightweight and respectful of end-user privacy. | ||
It uses the browser's timezone (via the brilliant [jstz](https://github.com/iansinnott/jstz) and [locale](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language) (`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. | ||
@@ -16,9 +17,33 @@ ## Usage | ||
```javascript | ||
import inEU, { isInEUTimezone, isEULocale } from '@segment/in-eu' | ||
import inEU from '@segment/in-eu' | ||
inEU() // same as (isInEUTimezone() || isEULocale()) | ||
inEU() | ||
// => true | false | ||
``` | ||
// or | ||
or try one of the more specific helpers: | ||
```javascript | ||
import { isInEUTimezone } from '@segment/in-eu' | ||
/* | ||
Only checks the browser timezone. | ||
Useful for checking if someone is phisically present in the EU | ||
*/ | ||
isInEUTimezone() | ||
// => true | false | ||
``` | ||
```javascript | ||
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 | ||
``` | ||
@@ -25,0 +50,0 @@ |
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
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
3791
50