# user-email

> Get the email address(es) of the current user

Latest version **1.0.4** (published 2018-11-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install user-email
pnpm add user-email
yarn add user-email
bun add user-email
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-11-26 |
| First published | 2016-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | verth |
| Maintainers | verth |
| Keywords | email, e-mail, address, e-mailaddress, current, user |

## Links

- npm: https://www.npmjs.com/package/user-email
- npm.io page: https://npm.io/package/user-email

## Dependencies (4)

- [execa](https://npm.io/package/execa.md) ^0.4.0
- [npm-email](https://npm.io/package/npm-email.md) ^2.0.0
- [tree-kill](https://npm.io/package/tree-kill.md) ^1.1.0
- [email-validator](https://npm.io/package/email-validator.md) ^1.0.4

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-11-26
- 1.0.3 — 2018-11-26
- 1.0.2 — 2018-11-26
- 1.0.1 — 2016-07-16
- 1.0.0 — 2016-06-17
- 0.4.0 — 2016-06-09
- 0.3.0 — 2016-06-02
- 0.2.1 — 2016-05-22
- 0.1.1 — 2016-05-12
- 0.0.4 — 2016-05-11
- 0.0.2 — 2016-05-11
- 0.0.1 — 2016-05-11

## README

# !! DEPRACTED !!

# node-user-email

Get the email address(es) of the current user.

## Installation

```
$ npm install user-email
```

## Usage

```javascript
import getEmail from 'user-email';

getEmail().then(email => {
    console.log(email);
    // logs: your@email.com
});
```

### Options

```javascript
import getEmail from 'user-email';
import {
    getEmailFromGit,
    getEmailFromNpmConfig,
    getEmailFromNpmWhoAmI
} from 'user-email/email-searchers';

getEmail({
    findAll: false,
    findIn: [
        getEmailFromGit,
        getEmailFromNpmConfig,
        getEmailFromNpmWhoAmI
    ],
    timeBeforeTimeout: 10000
}).then(email => {
    console.log(email);
});
```

**findAll**

*default: false*

If `findAll` is `false` the first valid email address that is found in the chain (`findIn`) will be returned. If `findAll` is `true` an array of all valid email addresses in the chain is returned.

**findIn**

*default: [getEmailFromGit, getEmailFromNpmConfig, getEmailFromNpmWhoAmI]*

`findIn` accepts an Array of functions that return a Promise. Each of these Promises resolve but don't reject, they return a valid email address or `null`.

The order or priority of functions for finding an email address is the same as the array.

**timeBeforeTimout (ms)**

*default: 10000*

Maximum time spent in a single Promise.

### Email-searchers

* getEmailFromGit:
  * `git config user.email`
* getEmailFromNpmConfig:
  * `npm config get init.author.email`
* getEmailFromNpmWhoAmI:
  * `npm whoami`
  * use username to lookup email address via [npm-email](https://github.com/sindresorhus/npm-email)

## License

MIT

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