# in-us

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

Latest version **0.0.2** (published 2018-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install in-us
pnpm add in-us
yarn add in-us
bun add in-us
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-10-08 |
| First published | 2018-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | UserMirror |
| Maintainers | fouad |
| Keywords | usa, in-us, locale, america, timezone, united states |

## Links

- npm: https://www.npmjs.com/package/in-us
- Repository: https://github.com/usermirror/in-us
- Homepage: https://github.com/usermirror/in-us#readme
- Issues: https://github.com/usermirror/in-us/issues
- npm.io page: https://npm.io/package/in-us

## Dependencies (1)

- [jstz](https://npm.io/package/jstz.md) ^2.0.0

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2018-10-08
- 0.0.1 — 2018-10-08

## README

<p align="center">
  <strong>🌎 in-us</strong>
</p>

<p align="center">
  Utility to determine if a user is in the United States<br />
  without an HTTP request or IP address.
</p>

<p align="center">
  <a href="https://unpkg.com/in-us/index.js">
    <img src="https://img.badgesize.io/https://unpkg.com/in-us/index.js?compression=gzip&amp;label=in--us&cache=2">
  </a>
  <a href="https://www.npmjs.com/package/in-us">
    <img src="https://img.shields.io/npm/v/in-us.svg?maxAge=3600&label=in-us&colorB=007ec6">
  </a>
</p>
<br/>

It uses the browser's timezone (via [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 United States.
This project is inspired by [`in-eu` by Segment](https://github.com/segmentio/in-eu).

## Getting Started

### Installation

Install with npm:

```bash
npm install --save in-us
```

Or with yarn:

```bash
yarn add in-us
```

## Usage

### inUS

```javascript
import inUS from 'in-us'

inUS()
// => true | false
```

### isInUSTimezone

```javascript
import { isInUSTimezone } from 'in-us'

/*
  Only checks the browser timezone.
  e.g. America/Chicago
*/

isInUSTimezone()
// => true | false
```

### isUSLocale

```javascript
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](./license).

---
_Source: https://npm.io/package/in-us · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
