1.0.4 • Published 7 years ago
user-email v1.0.4
!! DEPRACTED !!
node-user-email
Get the email address(es) of the current user.
Installation
$ npm install user-emailUsage
import getEmail from 'user-email';
getEmail().then(email => {
console.log(email);
// logs: your@email.com
});Options
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
License
MIT