├── .verb.md ├── .gitattributes ├── .travis.yml ├── .jshintrc ├── test.js ├── .editorconfig ├── index.js ├── .gitignore ├── LICENSE ├── package.json └── README.md /.verb.md: -------------------------------------------------------------------------------- 1 | ## Usage 2 | 3 | ```js 4 | var email = require('{%= name %}'); 5 | console.log(email()); 6 | //=> jon.schlinkert@sellside.com 7 | ``` 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | * text eol=lf 3 | 4 | # binaries 5 | *.ai binary 6 | *.psd binary 7 | *.jpg binary 8 | *.gif binary 9 | *.png binary 10 | *.jpeg binary -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - 'node' 5 | - '6' 6 | before_install: 7 | - git config --global user.email "jon.schlinkert@sellside.com" 8 | - git config --global user.name "jonschlinkert" 9 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": false, 3 | "boss": true, 4 | "curly": true, 5 | "eqeqeq": true, 6 | "eqnull": true, 7 | "esnext": true, 8 | "immed": true, 9 | "latedef": false, 10 | "laxcomma": false, 11 | "mocha": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "node": true, 15 | "sub": true, 16 | "undef": true, 17 | "unused": true 18 | } -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * git-user-email 3 | * 4 | * Copyright (c) 2015, Jon Schlinkert. 5 | * Licensed under the MIT License. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var assert = require('assert'); 11 | var email = require('./'); 12 | 13 | describe('email', function () { 14 | it('should return the email from git config:', function () { 15 | assert(email() === 'jon.schlinkert@sellside.com'); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | end_of_line = lf 7 | charset = utf-8 8 | indent_size = 2 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.json] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.yml] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.md] 21 | indent_style = space 22 | indent_size = 2 23 | trim_trailing_whitespace = false 24 | 25 | [test/fixtures/*] 26 | trim_trailing_whitespace = false 27 | insert_final_newline = false -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * git-user-email 3 | * 4 | * Copyright (c) 2014-2017, Jon Schlinkert. 5 | * Released under the MIT License. 6 | */ 7 | 8 | var gitconfig = require('git-config-path'); 9 | var parse = require('parse-git-config'); 10 | var extend = require('extend-shallow'); 11 | 12 | module.exports = function(options) { 13 | var gc = gitconfig(extend({type: 'global'}, options && options.gitconfig)); 14 | options = extend({cwd: '/', path: gc}, options); 15 | var config = parse.sync(options) || {}; 16 | return config.user ? config.user.email : null; 17 | }; 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Numerous always-ignore extensions 2 | *.DS_Store 3 | *.csv 4 | *.dat 5 | *.diff 6 | *.err 7 | *.gz 8 | *.log 9 | *.orig 10 | *.out 11 | *.pid 12 | *.rej 13 | *.seed 14 | *.swo 15 | *.swp 16 | *.vi 17 | *.yo-rc.json 18 | *.zip 19 | *~ 20 | .ruby-version 21 | lib-cov 22 | 23 | # OS or Editor folders 24 | *.esproj 25 | *.sublime-project 26 | *.sublime-workspace 27 | ._* 28 | .cache 29 | .DS_Store 30 | .idea 31 | .project 32 | .settings 33 | .tmproj 34 | nbproject 35 | Thumbs.db 36 | 37 | # Komodo 38 | *.komodoproject 39 | .komodotools 40 | 41 | # grunt-html-validation 42 | validation-status.json 43 | validation-report.json 44 | 45 | # Vendor packages 46 | node_modules 47 | bower_components 48 | vendor 49 | 50 | # General folders and files to ignore 51 | _gh_pages 52 | tmp 53 | temp 54 | TODO.md -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Jon Schlinkert, contributors. 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "git-user-email", 3 | "description": "Get the email address of the current user from git config.", 4 | "version": "0.2.2", 5 | "homepage": "https://github.com/jonschlinkert/git-user-email", 6 | "author": { 7 | "name": "Jon Schlinkert", 8 | "url": "http://github.com/https://github.com/jonschlinkert/", 9 | "username": "jonschlinkert", 10 | "twitter": "jonschlinkert" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git://github.com/jonschlinkert/git-user-email.git" 15 | }, 16 | "bugs": { 17 | "url": "https://github.com/jonschlinkert/git-user-email/issues" 18 | }, 19 | "license": { 20 | "type": "MIT", 21 | "url": "https://github.com/jonschlinkert/git-user-email/blob/master/LICENSE" 22 | }, 23 | "files": [ 24 | "index.js" 25 | ], 26 | "main": "index.js", 27 | "engines": { 28 | "node": ">=0.8" 29 | }, 30 | "scripts": { 31 | "test": "mocha" 32 | }, 33 | "dependencies": { 34 | "extend-shallow": "^2.0.1", 35 | "git-config-path": "^1.0.1", 36 | "parse-git-config": "^1.0.2" 37 | }, 38 | "devDependencies": { 39 | "gulp-format-md": "^0.1.11", 40 | "mocha": "*", 41 | "should": "*" 42 | }, 43 | "keywords": [ 44 | "config", 45 | "email", 46 | "git", 47 | "github", 48 | "user" 49 | ], 50 | "verb": { 51 | "toc": false, 52 | "layout": "default", 53 | "related": { 54 | "list": [ 55 | "git-config-path", 56 | "parse-git-config", 57 | "git-username", 58 | "git-repo-name", 59 | "git-branch" 60 | ] 61 | }, 62 | "tasks": [ 63 | "readme" 64 | ], 65 | "plugins": [ 66 | "gulp-format-md" 67 | ], 68 | "lint": { 69 | "reflinks": true 70 | }, 71 | "reflinks": [ 72 | "verb", 73 | "verb-generate-readme" 74 | ] 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-user-email [![NPM version](https://img.shields.io/npm/v/git-user-email.svg?style=flat)](https://www.npmjs.com/package/git-user-email) [![NPM downloads](https://img.shields.io/npm/dm/git-user-email.svg?style=flat)](https://npmjs.org/package/git-user-email) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/git-user-email.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/git-user-email) 2 | 3 | > Get the email address of the current user from git config. 4 | 5 | ## Install 6 | 7 | Install with [npm](https://www.npmjs.com/): 8 | 9 | ```sh 10 | $ npm install --save git-user-email 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | var email = require('git-user-email'); 17 | console.log(email()); 18 | //=> jon.schlinkert@sellside.com 19 | ``` 20 | 21 | ## About 22 | 23 | ### Related projects 24 | 25 | * [git-branch](https://www.npmjs.com/package/git-branch): Get the current branch for a local git repository. | [homepage](https://github.com/jonschlinkert/git-branch "Get the current branch for a local git repository.") 26 | * [git-config-path](https://www.npmjs.com/package/git-config-path): Resolve the path to the user's local or global .gitconfig. | [homepage](https://github.com/jonschlinkert/git-config-path "Resolve the path to the user's local or global .gitconfig.") 27 | * [git-repo-name](https://www.npmjs.com/package/git-repo-name): Get the repository name from the git remote origin URL. | [homepage](https://github.com/jonschlinkert/git-repo-name "Get the repository name from the git remote origin URL.") 28 | * [git-username](https://www.npmjs.com/package/git-username): Get the username from a git remote origin URL. | [homepage](https://github.com/jonschlinkert/git-username "Get the username from a git remote origin URL.") 29 | * [parse-git-config](https://www.npmjs.com/package/parse-git-config): Parse `.git/config` into a JavaScript object. sync or async. | [homepage](https://github.com/jonschlinkert/parse-git-config "Parse `.git/config` into a JavaScript object. sync or async.") 30 | 31 | ### Contributing 32 | 33 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). 34 | 35 | ### Building docs 36 | 37 | _(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ 38 | 39 | To generate the readme and API documentation with [verb](https://github.com/verbose/verb): 40 | 41 | ```sh 42 | $ npm install -g verb verb-generate-readme && verb 43 | ``` 44 | 45 | ### Running tests 46 | 47 | Install dev dependencies: 48 | 49 | ```sh 50 | $ npm install -d && npm test 51 | ``` 52 | 53 | ### Author 54 | 55 | **Jon Schlinkert** 56 | 57 | * [github/jonschlinkert](https://github.com/jonschlinkert) 58 | * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 59 | 60 | ### License 61 | 62 | Copyright © 2016, [Jon Schlinkert](http://github.com/https://github.com/jonschlinkert/). 63 | Released under the [MIT license](LICENSE). 64 | 65 | *** 66 | 67 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 29, 2016._ --------------------------------------------------------------------------------