
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@segment/in-regions
Advanced tools
🔒Privacy-first location detection library for browsers
in-regions
is a library for roughly detecting whether or not a website user is in a given "region". 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 a user's location. in-regions
trades absolute accuracy for a cautious approach that's more lightweight and respectful of end-user privacy.
At Segment, we use in-regions
to ask the question "Should we ask this user for their consent before tracking first-party data?". Because of this, we believe in casting a wider net, and are fine with trading accuracy for a more respectful approach towards consent.
As we prepare for CCPA, in-regions
supports "EU" and individual US states and territories (via npm package 'us') as valid regions.
npm install @segment/in-regions
Use in-regions
to generate your own custom location method. Our inRegions
function is a higher-order function that returns a custom function for your custom use cases.
For example, to generate a function that tests whether or not a user is in the EU:
import inRegions from '@segment/in-regions'
const inEU = inRegions(["EU"])
// => () => true/false
If you wanted to include both residents of California and EU residents (like we are!):
const inCustomRegion = inRegions(["EU", "CA"])
const isInCustomRegion = inCustomRegion() // isInCustomRegion would be 'true' if current user is in EU or CA
in-regions
also wraps, and exports all methods available in in-eu:
import { isInEUTimezone, isEULocale, inEU } from '@segment/in-eu'
/*
Only checks the browser timezone.
Useful for checking if someone is physically present in the EU
*/
isInEUTimezone()
// => true | false
/*
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
inEU()
// => true | false
FAQs
🔒Privacy-first location detection library for browsers
The npm package @segment/in-regions receives a total of 24,387 weekly downloads. As such, @segment/in-regions popularity was classified as popular.
We found that @segment/in-regions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 250 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.