in-us

0.0.2 • Public • Published

🌎 in-us

Utility to determine if a user is in the United States
without an HTTP request or IP address.


It uses the browser's timezone (via jstz and locale (navigator.languages) to infer whether someone is in United States. This project is inspired by in-eu by Segment.

Getting Started

Installation

Install with npm:

npm install --save in-us

Or with yarn:

yarn add in-us

Usage

inUS

import inUS from 'in-us'
 
inUS()
// => true | false

isInUSTimezone

import { isInUSTimezone } from 'in-us'
 
/*
  Only checks the browser timezone.
  e.g. America/Chicago
*/
 
isInUSTimezone()
// => true | false

isUSLocale

import { isUSLocale } from 'in-us'
 
/*
  Only uses the browser's language/locale
  e.g. es-US (spanish from United Staes)
*/
 
isUSLocale()
// => true | false

Contributing

All contributions are super welcome! in-us is MIT-licensed.

Package Sidebar

Install

npm i in-us

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

5.02 kB

Total Files

4

Last publish

Collaborators

  • fouad