New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

repo-utils

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

repo-utils - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

340

index.js

@@ -22,12 +22,12 @@ 'use strict';

* ```js
* repoUtils.name(process.cwd());
* repo.name(process.cwd());
* //=> 'repo-utils'
* repoUtils.name('.');
* repo.name('.');
* //=> 'repo-utils'
* repoUtils.name();
* repo.name();
* //=> 'repo-utils'
*
* repoUtils.name('https://github.com/jonschlinkert/repo-utils');
* repo.name('https://github.com/jonschlinkert/repo-utils');
* //=> 'repo-utils'
* repoUtils.name('jonschlinkert/repo-utils');
* repo.name('jonschlinkert/repo-utils');
* //=> 'repo-utils'

@@ -59,9 +59,9 @@ * ```

* ```js
* repoUtils.repository('jonschlinkert', 'micromatch');
* repo.repository('jonschlinkert', 'micromatch');
* //=> 'jonschlinkert/micromatch'
*
* repoUtils.repository({owner: 'jonschlinkert', repository: 'micromatch'});
* repo.repository({owner: 'jonschlinkert', repository: 'micromatch'});
* //=> 'jonschlinkert/micromatch'
*
* repoUtils.repository('https://github.com/jonschlinkert/micromatch');
* repo.repository('https://github.com/jonschlinkert/micromatch');
* //=> 'jonschlinkert/micromatch'

@@ -113,3 +113,3 @@ * ```

* ```js
* repoUtils.homepage('jonschlinkert/repo-utils');
* repo.homepage('jonschlinkert/repo-utils');
* //=> 'https://github.com/jonchlinkert/repo-utils'

@@ -169,3 +169,3 @@ * ```

* ```js
* repoUtils.isses('jonschlinkert/micromatch');
* repo.isses('jonschlinkert/micromatch');
* //=> 'https://github.com/jonchlinkert/micromatch/issues'

@@ -187,3 +187,3 @@ * ```

* ```js
* repoUtils.bugs('jonschlinkert/micromatch');
* repo.bugs('jonschlinkert/micromatch');
* //=> 'https://github.com/jonchlinkert/micromatch/issues'

@@ -205,3 +205,3 @@ * ```

* ```js
* repoUtils.https('jonschlinkert/micromatch');
* repo.https('jonschlinkert/micromatch');
* //=> 'https://github.com/jonchlinkert/micromatch'

@@ -230,3 +230,3 @@ * ```

* ```js
* repoUtils.travis('jonschlinkert/micromatch');
* repo.travis('jonschlinkert/micromatch');
* //=> 'https://travis-ci.org/jonschlinkert/micromatch'

@@ -250,6 +250,6 @@ * ```

* ```js
* repoUtils.file('https://github.com/jonschlinkert/micromatch', 'README.md');
* repo.file('https://github.com/jonschlinkert/micromatch', 'README.md');
* //=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'
*
* repoUtils.raw('jonschlinkert/micromatch', 'README.md');
* repo.raw('jonschlinkert/micromatch', 'README.md');
* //=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'

@@ -277,6 +277,6 @@ * ```

* ```js
* repoUtils.raw('https://github.com/jonschlinkert/micromatch', 'README.md');
* repo.raw('https://github.com/jonschlinkert/micromatch', 'README.md');
* //=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'
*
* repoUtils.raw('jonschlinkert/micromatch', 'README.md');
* repo.raw('jonschlinkert/micromatch', 'README.md');
* //=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'

@@ -330,3 +330,3 @@ * ```

* // see the tests for supported formats
* repoUtils.parse('https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md');
* repo.parse('https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md');
*

@@ -359,6 +359,7 @@ * // results in:

var defaults = {protocol: 'https:', slashes: true, hostname: 'github.com'};
options = utils.omitEmpty(options || {});
options = utils.omitEmpty(utils.extend({}, options));
// if `foo/bar` is passed, use github.com as default host
if (!/:\/\//.test(repoUrl)) {
repoUrl = 'https://github.com/' + repoUrl;
repoUrl = (options.host || 'https://github.com/') + repoUrl;
}

@@ -383,3 +384,3 @@

* // see the tests for supported formats
* repoUtils.expand('https://github.com/abc/xyz.git', 'README.md');
* repo.expand('https://github.com/abc/xyz.git', 'README.md');
*

@@ -446,2 +447,22 @@ * // results in:

/**
* Get the local git config path, or global if a local `.git` repository does not exist.
*
* ```js
* console.log(repo.gitConfigPath());
* //=> /Users/jonschlinkert/dev/repo-utils/.git/config
*
* // if local .git repo does not exist
* console.log(repo.gitConfigPath());
* /Users/jonschlinkert/.gitconfig
*
* // get global path
* console.log(repo.gitConfigPath('global'));
* /Users/jonschlinkert/.gitconfig
* ```
* @param {String} `type` Pass `global` to get the global git config path regardless of whether or not a local repository exists.
* @return {String} Returns the local or global git path
* @api public
*/
repo.gitConfigPath = function(type) {

@@ -451,2 +472,13 @@ return utils.gitConfigPath(type);

/**
* Get and parse global git config.
*
* ```js
* console.log(repo.gitConfig());
* ```
* @param {Object} `options` To get a local `.git` config, pass `{type: 'local'}`
* @return {Object}
* @api public
*/
repo.gitConfig = function(options) {

@@ -462,3 +494,3 @@ if (gitConfigCache) return gitConfigCache;

if (git && git.user) {
git = utils.merge(git, utils.parseGitConfig.keys(git));
utils.merge(git, utils.parseGitConfig.keys(git));
}

@@ -471,49 +503,232 @@ gitConfigCache = git;

repo.gitUser = function(options) {
var git = repo.gitConfig(options);
if (utils.isObject(git)) {
return git.user;
}
return utils.get(repo.gitConfig(options), 'user');
};
repo.gitUserName = function(options) {
var user = repo.gitUser(options);
if (utils.isObject(user)) {
return user.name;
return utils.get(repo.gitUser(options), 'name');
};
repo.gitUserEmail = function(options) {
return utils.get(repo.gitUser(options), 'email');
};
/**
* Get an owner string from the given object or string.
*
* ```js
* console.log(repo.owner(require('./package.json')));
* //=> 'jonschlinkert'
* ```
* @param {String|Object} `config` If an object is passed, it must have a `repository`, `url` or `author` propert (looked for in that order), otherwise if a string is passed it must be parse-able by the [parseUrl]() method.
* @return {String}
* @api public
*/
repo.owner = function(config) {
var owner;
if (utils.isString(config)) {
config = repo.parseUrl(config);
}
if (utils.isObject(config)) {
owner = utils.get(config, 'owner');
if (typeof owner === 'undefined' && config.repository) {
var repository = config.repository;
if (utils.isObject(repository)) {
repository = repository.url;
}
config = repo.parseUrl(repository);
owner = utils.get(config, 'owner');
}
if (typeof owner === 'undefined' && config.url) {
config = repo.parseUrl(config.url);
owner = utils.get(config, 'owner');
}
if (typeof owner === 'undefined' && config.author) {
var author = repo.parseAuthor(config.author);
config = repo.parseUrl(author.url);
owner = utils.get(config, 'owner');
}
}
return owner;
};
repo.gitUserEmail = function(options) {
var user = repo.gitUser(options);
if (utils.isObject(user)) {
return user.email;
/**
* Normalize a "person" object. If a "person" string is passed (like `author`, `contributor` etc)
* it is parsed into an object, otherwise the object is returned.
*
* ```js
* console.log(repo.person('Brian Woodward (https://github.com/doowb)'));
* //=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
* console.log(repo.person({ name: 'Brian Woodward', url: 'https://github.com/doowb' }));
* //=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
* ```
* @param {String|Object} `val`
* @return {Object}
* @api public
*/
repo.person = function(val) {
var person = val;
if (utils.isString(val)) {
person = utils.parseAuthor(val);
}
if (utils.isObject(person)) {
person = utils.omitEmpty(person);
}
return person;
};
repo.author = function(config, options) {
/**
* Returns an `author` object from the given given config object. If `config.author` is
* a string it will be parsed into an object.
*
* ```js
* console.log(repo.author({
* author: 'Brian Woodward (https://github.com/doowb)'
* }));
* //=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
*
* console.log(repo.author({
* name: 'Brian Woodward',
* url: 'https://github.com/doowb'
* }));
* //=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
* ```
* @param {Object} `config` Object with an `author` property
* @return {Object}
* @api public
*/
repo.author = function(config) {
if (!utils.isObject(config)) {
throw new TypeError('expected an object');
}
var author = config.author;
if (utils.isString(author)) {
author = utils.parseAuthor(author);
}
if (utils.isObject(author)) {
return utils.omitEmpty(author);
}
return repo.person(config.author);
};
/**
* Returns the `author.name` from the given config object. If `config.author` is
* a string it will be parsed into an object first.
*
* ```js
* console.log(repo.authorName({
* author: 'Brian Woodward (https://github.com/doowb)'
* }));
* //=> 'Brian Woodward'
*
* console.log(repo.authorName({
* name: 'Brian Woodward',
* url: 'https://github.com/doowb'
* }));
* //=> 'Brian Woodward'
* ```
* @param {Object} `config` Object with an `author` property
* @return {Object}
* @api public
*/
repo.authorName = function(config, options) {
var author = repo.author(config, options);
if (utils.isObject(author)) {
return author.name;
}
return utils.get(repo.author(config, options), 'name');
};
/**
* Returns the `author.url` from the given config object. If `config.author` is
* a string it will be parsed into an object first.
*
* ```js
* console.log(repo.authorUrl({
* author: 'Brian Woodward (https://github.com/doowb)'
* }));
* //=> 'https://github.com/doowb'
*
* console.log(repo.authorUrl({
* name: 'Brian Woodward',
* url: 'https://github.com/doowb'
* }));
* //=> 'https://github.com/doowb'
* ```
* @param {Object} `config` Object with an `author` property
* @return {Object}
* @api public
*/
repo.authorUrl = function(config, options) {
var author = repo.author(config, options);
if (utils.isObject(author)) {
return author.url;
}
return utils.get(repo.author(config, options), 'url');
};
/**
* Returns the `author.email` from the given config object. If `config.author` is
* a string it will be parsed into an object first.
*
* ```js
* console.log(repo.authorEmail({
* author: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'
* }));
* //=> 'brian.woodward@sellside.com'
*
* console.log(repo.authorEmail({
* name: 'Brian Woodward',
* url: 'https://github.com/doowb',
* email: 'brian.woodward@sellside.com'
* }));
* //=> 'brian.woodward@sellside.com'
* ```
* @param {Object} `config` Object with an `author` property
* @return {Object}
* @api public
*/
repo.authorEmail = function(config, options) {
return utils.get(repo.author(config, options), 'email');
};
/**
* Returns the `author.username` from the given config object. If `config.author` is
* a string it will be parsed into an object first.
*
* ```js
* console.log(repo.authorUsername({
* author: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'
* }));
* //=> 'doowb'
*
* console.log(repo.authorUsername({
* name: 'Brian Woodward',
* url: 'https://github.com/doowb',
* email: 'brian.woodward@sellside.com'
* }));
* //=> 'doowb'
* ```
* @param {Object} `config` Object with an `author` property
* @return {Object}
* @api public
*/
repo.authorUsername = function(config, options) {
return utils.get(repo.author(config, options), 'username');
};
/**
* Returns a `username` from the given config object, by first attempting to get
* `author.username`, then
*
* ```js
* console.log(repo.username({
* author: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'
* }));
* //=> 'doowb'
*
* console.log(repo.username({
* name: 'Brian Woodward',
* url: 'https://github.com/doowb',
* email: 'brian.woodward@sellside.com'
* }));
* //=> 'doowb'
* ```
* @param {Object} `config` Object with an `author` property
* @return {Object}
* @api public
*/
repo.username = function(config, options) {

@@ -524,18 +739,8 @@ if (!utils.isObject(config)) {

var username = null;
if (typeof config.username === 'string') {
username = config.username;
}
var username = repo.authorUsername(config);
if (!utils.isString(username)) {
var authorUrl = repo.authorUrl(config, options);
if (!/github\.com/.test(authorUrl)) {
authorUrl = null;
if (/github\.com/.test(authorUrl)) {
username = utils.get(utils.parseGithubUrl(authorUrl), 'owner');
}
var str = authorUrl || config.repository || config.homepage;
var parsed = utils.parseGithubUrl(str);
if (parsed && parsed.owner) {
username = parsed.owner;
}
}

@@ -546,2 +751,7 @@

}
if (!utils.isString(username)) {
var str = config.repository || config.homepage;
username = utils.get(utils.parseGithubUrl(str), 'owner');
}
return username;

@@ -561,1 +771,7 @@ };

};
/**
* Expose `parseAuthor`
*/
repo.parseAuthor = utils.parseAuthor;

41

package.json
{
"name": "repo-utils",
"description": "Utils for normalizing and formatting repo data.",
"version": "0.3.1",
"version": "0.3.2",
"homepage": "https://github.com/jonschlinkert/repo-utils",

@@ -24,11 +24,13 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"extend-shallow": "^2.0.1",
"get-value": "^2.0.5",
"git-config-path": "^0.2.0",
"is-absolute": "^0.2.4",
"is-absolute": "^0.2.5",
"kind-of": "^3.0.2",
"lazy-cache": "^1.0.3",
"lazy-cache": "^2.0.1",
"mixin-deep": "^1.1.3",
"omit-empty": "^0.3.4",
"parse-author": "^0.2.1",
"parse-git-config": "^0.4.0",
"parse-github-url": "^0.3.0",
"omit-empty": "^0.3.6",
"parse-author": "^1.0.0",
"parse-git-config": "^0.4.2",
"parse-github-url": "^0.3.1",
"project-name": "^0.2.4"

@@ -39,4 +41,4 @@ },

"gulp-eslint": "^2.0.0",
"gulp-format-md": "^0.1.7",
"gulp-istanbul": "^0.10.3",
"gulp-format-md": "^0.1.9",
"gulp-istanbul": "^0.10.4",
"gulp-mocha": "^2.2.0",

@@ -59,8 +61,2 @@ "gulp-unused": "^0.1.2",

"verb": {
"run": true,
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"helpers": [

@@ -75,6 +71,21 @@ "helper-coverage"

],
"run": true,
"toc": false,
"layout": "default",
"lint": {
"reflinks": true
},
"tasks": [
"readme"
],
"related": {
"highlight": "parse-git-config",
"list": [
"git-config-path",
"parse-git-config",
"parse-author",
"project-name"
]
}
}
}
# repo-utils [![NPM version](https://img.shields.io/npm/v/repo-utils.svg?style=flat)](https://www.npmjs.com/package/repo-utils) [![NPM downloads](https://img.shields.io/npm/dm/repo-utils.svg?style=flat)](https://npmjs.org/package/repo-utils) [![Build Status](https://img.shields.io/travis/jonschlinkert/repo-utils.svg?style=flat)](https://travis-ci.org/jonschlinkert/repo-utils)
> Utils for normalizing and formatting repo data.
Utils for normalizing and formatting repo data.
You might also be interested in [parse-git-config](https://github.com/jonschlinkert/parse-git-config).
## Install

@@ -16,3 +18,3 @@

```js
var repoUtils = require('repo-utils');
var repo = require('repo-utils');
```

@@ -34,12 +36,12 @@

```js
repoUtils.name(process.cwd());
repo.name(process.cwd());
//=> 'repo-utils'
repoUtils.name('.');
repo.name('.');
//=> 'repo-utils'
repoUtils.name();
repo.name();
//=> 'repo-utils'
repoUtils.name('https://github.com/jonschlinkert/repo-utils');
repo.name('https://github.com/jonschlinkert/repo-utils');
//=> 'repo-utils'
repoUtils.name('jonschlinkert/repo-utils');
repo.name('jonschlinkert/repo-utils');
//=> 'repo-utils'

@@ -61,9 +63,9 @@ ```

```js
repoUtils.repository('jonschlinkert', 'micromatch');
repo.repository('jonschlinkert', 'micromatch');
//=> 'jonschlinkert/micromatch'
repoUtils.repository({owner: 'jonschlinkert', repository: 'micromatch'});
repo.repository({owner: 'jonschlinkert', repository: 'micromatch'});
//=> 'jonschlinkert/micromatch'
repoUtils.repository('https://github.com/jonschlinkert/micromatch');
repo.repository('https://github.com/jonschlinkert/micromatch');
//=> 'jonschlinkert/micromatch'

@@ -85,3 +87,3 @@ ```

```js
repoUtils.homepage('jonschlinkert/repo-utils');
repo.homepage('jonschlinkert/repo-utils');
//=> 'https://github.com/jonchlinkert/repo-utils'

@@ -103,3 +105,3 @@ ```

```js
repoUtils.isses('jonschlinkert/micromatch');
repo.isses('jonschlinkert/micromatch');
//=> 'https://github.com/jonchlinkert/micromatch/issues'

@@ -121,3 +123,3 @@ ```

```js
repoUtils.bugs('jonschlinkert/micromatch');
repo.bugs('jonschlinkert/micromatch');
//=> 'https://github.com/jonchlinkert/micromatch/issues'

@@ -140,3 +142,3 @@ ```

```js
repoUtils.https('jonschlinkert/micromatch');
repo.https('jonschlinkert/micromatch');
//=> 'https://github.com/jonchlinkert/micromatch'

@@ -159,3 +161,3 @@ ```

```js
repoUtils.travis('jonschlinkert/micromatch');
repo.travis('jonschlinkert/micromatch');
//=> 'https://travis-ci.org/jonschlinkert/micromatch'

@@ -178,6 +180,6 @@ ```

```js
repoUtils.file('https://github.com/jonschlinkert/micromatch', 'README.md');
repo.file('https://github.com/jonschlinkert/micromatch', 'README.md');
//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'
repoUtils.raw('jonschlinkert/micromatch', 'README.md');
repo.raw('jonschlinkert/micromatch', 'README.md');
//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'

@@ -200,6 +202,6 @@ ```

```js
repoUtils.raw('https://github.com/jonschlinkert/micromatch', 'README.md');
repo.raw('https://github.com/jonschlinkert/micromatch', 'README.md');
//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'
repoUtils.raw('jonschlinkert/micromatch', 'README.md');
repo.raw('jonschlinkert/micromatch', 'README.md');
//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'

@@ -240,3 +242,3 @@ ```

// see the tests for supported formats
repoUtils.parse('https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md');
repo.parse('https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md');

@@ -258,3 +260,3 @@ // results in:

### [.expandUrl](index.js#L404)
### [.expandUrl](index.js#L405)

@@ -273,3 +275,3 @@ Parse a GitHub `repository` path or URL by calling `repo.parseUrl()`, then expands it into an object of URLs. (the object also includes properties returned from `.parse()`). A file path maybe be passed as the second argument to include `raw` and `file` properties in the result.

// see the tests for supported formats
repoUtils.expand('https://github.com/abc/xyz.git', 'README.md');
repo.expand('https://github.com/abc/xyz.git', 'README.md');

@@ -301,5 +303,225 @@ // results in:

### [.gitConfigPath](index.js#L455)
Get the local git config path, or global if a local `.git` repository does not exist.
**Params**
* `type` **{String}**: Pass `global` to get the global git config path regardless of whether or not a local repository exists.
* `returns` **{String}**: Returns the local or global git path
**Example**
```js
console.log(repo.gitConfigPath());
//=> /Users/jonschlinkert/dev/repo-utils/.git/config
// if local .git repo does not exist
console.log(repo.gitConfigPath());
/Users/jonschlinkert/.gitconfig
// get global path
console.log(repo.gitConfigPath('global'));
/Users/jonschlinkert/.gitconfig
```
### [.gitConfig](index.js#L470)
Get and parse global git config.
**Params**
* `options` **{Object}**: To get a local `.git` config, pass `{type: 'local'}`
* `returns` **{Object}**
**Example**
```js
console.log(repo.gitConfig());
```
### [.owner](index.js#L510)
Get an owner string from the given object or string.
**Params**
* `config` **{String|Object}**: If an object is passed, it must have a `repository`, `url` or `author` propert (looked for in that order), otherwise if a string is passed it must be parse-able by the [parseUrl](#parseUrl) method.
* `returns` **{String}**
**Example**
```js
console.log(repo.owner(require('./package.json')));
//=> 'jonschlinkert'
```
### [.person](index.js#L555)
Normalize a "person" object. If a "person" string is passed (like `author`, `contributor` etc) it is parsed into an object, otherwise the object is returned.
**Params**
* `val` **{String|Object}**
* `returns` **{Object}**
**Example**
```js
console.log(repo.person('Brian Woodward (https://github.com/doowb)'));
//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
console.log(repo.person({ name: 'Brian Woodward', url: 'https://github.com/doowb' }));
//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
```
### [.author](index.js#L587)
Returns an `author` object from the given given config object. If `config.author` is a string it will be parsed into an object.
**Params**
* `config` **{Object}**: Object with an `author` property
* `returns` **{Object}**
**Example**
```js
console.log(repo.author({
author: 'Brian Woodward (https://github.com/doowb)'
}));
//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
console.log(repo.author({
name: 'Brian Woodward',
url: 'https://github.com/doowb'
}));
//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }
```
### [.authorName](index.js#L615)
Returns the `author.name` from the given config object. If `config.author` is a string it will be parsed into an object first.
**Params**
* `config` **{Object}**: Object with an `author` property
* `returns` **{Object}**
**Example**
```js
console.log(repo.authorName({
author: 'Brian Woodward (https://github.com/doowb)'
}));
//=> 'Brian Woodward'
console.log(repo.authorName({
name: 'Brian Woodward',
url: 'https://github.com/doowb'
}));
//=> 'Brian Woodward'
```
### [.authorUrl](index.js#L640)
Returns the `author.url` from the given config object. If `config.author` is a string it will be parsed into an object first.
**Params**
* `config` **{Object}**: Object with an `author` property
* `returns` **{Object}**
**Example**
```js
console.log(repo.authorUrl({
author: 'Brian Woodward (https://github.com/doowb)'
}));
//=> 'https://github.com/doowb'
console.log(repo.authorUrl({
name: 'Brian Woodward',
url: 'https://github.com/doowb'
}));
//=> 'https://github.com/doowb'
```
### [.authorEmail](index.js#L666)
Returns the `author.email` from the given config object. If `config.author` is a string it will be parsed into an object first.
**Params**
* `config` **{Object}**: Object with an `author` property
* `returns` **{Object}**
**Example**
```js
console.log(repo.authorEmail({
author: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'
}));
//=> 'brian.woodward@sellside.com'
console.log(repo.authorEmail({
name: 'Brian Woodward',
url: 'https://github.com/doowb',
email: 'brian.woodward@sellside.com'
}));
//=> 'brian.woodward@sellside.com'
```
### [.authorUsername](index.js#L692)
Returns the `author.username` from the given config object. If `config.author` is a string it will be parsed into an object first.
**Params**
* `config` **{Object}**: Object with an `author` property
* `returns` **{Object}**
**Example**
```js
console.log(repo.authorUsername({
author: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'
}));
//=> 'doowb'
console.log(repo.authorUsername({
name: 'Brian Woodward',
url: 'https://github.com/doowb',
email: 'brian.woodward@sellside.com'
}));
//=> 'doowb'
```
### [.username](index.js#L718)
Returns a `username` from the given config object, by first attempting to get `author.username`, then
**Params**
* `config` **{Object}**: Object with an `author` property
* `returns` **{Object}**
**Example**
```js
console.log(repo.username({
author: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'
}));
//=> 'doowb'
console.log(repo.username({
name: 'Brian Woodward',
url: 'https://github.com/doowb',
email: 'brian.woodward@sellside.com'
}));
//=> 'doowb'
```
## Coverage
As of March 29, 2016:
As of May 03, 2016:

@@ -313,2 +535,11 @@ ```

## Related projects
You might also be interested in these projects:
* [git-config-path](https://www.npmjs.com/package/git-config-path): Resolve the path to the user's global .gitconfig. | [homepage](https://github.com/jonschlinkert/git-config-path)
* [parse-author](https://www.npmjs.com/package/parse-author): Parse a string into an object with `name`, `email` and `url` properties following npm conventions.… [more](https://www.npmjs.com/package/parse-author) | [homepage](https://github.com/jonschlinkert/parse-author)
* [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)
* [project-name](https://www.npmjs.com/package/project-name): Get the name of a project, from package.json, git config, or basename of the current… [more](https://www.npmjs.com/package/project-name) | [homepage](https://github.com/jonschlinkert/project-name)
## Contributing

@@ -345,3 +576,3 @@

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/](http://twitter.com/)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

@@ -355,2 +586,2 @@ ## License

_This file was generated by [verb](https://github.com/verbose/verb), v, on March 29, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 03, 2016._

@@ -11,2 +11,4 @@ 'use strict';

require('extend-shallow', 'extend');
require('get-value');
require('git-config-path');

@@ -24,2 +26,10 @@ require('is-absolute');

/**
* Get `prop` from the given object
*/
utils.get = function(obj, prop) {
return utils.getValue(obj || {}, prop);
};
/**
* Return true if `val` is an object

@@ -26,0 +36,0 @@ */

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc