{"name":"repo-utils","description":"Utils for normalizing and formatting repo data.","version":"0.2.0","homepage":"https://github.com/jonschlinkert/repo-utils","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/repo-utils.git"},"bugs":{"url":"https://github.com/jonschlinkert/repo-utils/issues"},"license":"MIT","files":["index.js","lib"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"is-absolute":"^0.2.3","kind-of":"^0.1.2","lazy-cache":"^1.0.3","mixin-deep":"^1.1.3","omit-empty":"^0.3.3","parse-github-url":"^0.3.0","project-name":"^0.2.4"},"devDependencies":{"glob-keys":"^0.1.0","gulp":"^3.9.1","gulp-eslint":"^2.0.0","gulp-format-md":"^0.1.7","gulp-istanbul":"^0.10.3","gulp-mocha":"^2.2.0","gulp-unused":"^0.1.2","helper-coverage":"^0.1.3","mocha":"*"},"keywords":["git","github","repo","repo-utils","repository","url","utilities","utility","utils"],"verb":{"run":true,"toc":false,"layout":"default","tasks":["readme"],"helpers":["helper-coverage"],"plugins":["gulp-format-md"],"reflinks":["verb"],"lint":{"reflinks":true}},"gitHead":"d881c6002e3d8f57465ab19fe345801af6391043","_id":"repo-utils@0.2.0","_shasum":"70b6ac46ae68ca7bb8aedb5312e4b5a8812f4dd3","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"70b6ac46ae68ca7bb8aedb5312e4b5a8812f4dd3","tarball":"http://registry-npm.ywwl.com/repo-utils/download/repo-utils-0.2.0.tgz","integrity":"sha512-8YRGcpV8Gq0GAbWv4KrWnPW+IJmAc5iKQOJbMVjEHYdveOqeWMGF/pBJWE75dwGRzay9gE/YORRi3fVSCNMFTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC5XAtP8gCXfqNCdWaRtRjnYJehKyxG9YS3x98EkszXcAiEAiXyVgKCmpLUyoxEyVoqTXaVC4xEz+aO6FZ1D1g57oHk="}],"size":5679,"noattachment":false,"key":"/repo-utils/-/repo-utils-0.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/repo-utils-0.2.0.tgz_1459130615889_0.16809824365191162"},"directories":{},"readme":"# repo-utils [![NPM version](https://img.shields.io/npm/v/repo-utils.svg?style=flat)](https://www.npmjs.com/package/repo-utils) [![NPM monthly downloads](https://img.shields.io/npm/dm/repo-utils.svg?style=flat)](https://npmjs.org/package/repo-utils)  [![NPM total downloads](https://img.shields.io/npm/dt/repo-utils.svg?style=flat)](https://npmjs.org/package/repo-utils) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/repo-utils.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/repo-utils)\n\n> Utils for normalizing and formatting repo data.\n\nYou might also be interested in [parse-git-config](https://github.com/jonschlinkert/parse-git-config).\n\n<details>\n<summary><strong>Table of Contents</strong></summary>\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [Coverage](#coverage)\n- [About](#about)\n</details>\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save repo-utils\n```\n\n## Usage\n\n```js\nvar repo = require('repo-utils');\n```\n\n## API\n\n### [.name](index.js#L42)\n\nGet the `name` for a repository from: - github repository path (`owner/project-name`) - github URL - absolute file path to a directory on the local file system (`.` and `''` may be used as aliases for the current working directory)\n\n**Params**\n\n* `cwd` **{String}**: Absolute file path or github URL\n* `returns` **{String}**: Project name\n\n**Example**\n\n```js\nrepo.name(process.cwd());\n//=> 'repo-utils'\nrepo.name('.');\n//=> 'repo-utils'\nrepo.name();\n//=> 'repo-utils'\n\nrepo.name('https://github.com/jonschlinkert/repo-utils');\n//=> 'repo-utils'\nrepo.name('jonschlinkert/repo-utils');\n//=> 'repo-utils'\n```\n\n### [.repository](index.js#L75)\n\nCreate a github repository string in the form of `owner/name`, from: - full github repository URL - object returned from `url.parse` - list of arguments in the form of `owner, name`\n\n**Params**\n\n* `owner` **{String}**: Repository owner\n* `name` **{String}**: Repository name\n* `returns` **{String}**: Reps\n\n**Example**\n\n```js\nrepo.repository('jonschlinkert', 'micromatch');\n//=> 'jonschlinkert/micromatch'\n\nrepo.repository({owner: 'jonschlinkert', repository: 'micromatch'});\n//=> 'jonschlinkert/micromatch'\n\nrepo.repository('https://github.com/jonschlinkert/micromatch');\n//=> 'jonschlinkert/micromatch'\n```\n\n### [.homepage](index.js#L122)\n\nCreate a `homepage` URL from a github repository path or github repository URL.\n\n**Params**\n\n* `repository` **{String}**: Repository in the form of `owner/project-name`\n* `options` **{Object}**\n* `returns` **{String}**: Formatted github homepage url.\n\n**Example**\n\n```js\nrepo.homepage('jonschlinkert/repo-utils');\n//=> 'https://github.com/jonchlinkert/repo-utils'\n```\n\n### [.issues](index.js#L177)\n\nCreate a GitHub `issues` URL.\n\n**Params**\n\n* `repository` **{String}**: Repository in the form of `owner/project-name` or full github project URL.\n* `options` **{Object}**\n* `returns` **{String}**\n\n**Example**\n\n```js\nrepo.isses('jonschlinkert/micromatch');\n//=> 'https://github.com/jonchlinkert/micromatch/issues'\n```\n\n### [.bugs](index.js#L194)\n\nCreate a GitHub `bugs` URL. Alias for [.issues](#issues).\n\n**Params**\n\n* `repository` **{String}**: Repository in the form of `owner/project-name`\n* `options` **{Object}**\n* `returns` **{String}**\n\n**Example**\n\n```js\nrepo.bugs('jonschlinkert/micromatch');\n//=> 'https://github.com/jonchlinkert/micromatch/issues'\n```\n\n### [.https](index.js#L212)\n\nCreate a github `https` URL.\n\n**Params**\n\n* `repository` **{String}**: Repository in the form of `owner/project-name`\n* `options` **{Object|String}**: Options object or optional branch\n* `branch` **{String}**: Optionally specify a branch\n* `returns` **{String}**\n\n**Example**\n\n```js\nrepo.https('jonschlinkert/micromatch');\n//=> 'https://github.com/jonchlinkert/micromatch'\n```\n\n### [.travis](index.js#L236)\n\nCreate a travis URL.\n\n**Params**\n\n* `repository` **{String}**: Repository in the form of `owner/project-name`\n* `options` **{Object|String}**: Options object or optional branch\n* `branch` **{String}**: Optionally specify a branch\n* `returns` **{String}**\n\n**Example**\n\n```js\nrepo.travis('jonschlinkert/micromatch');\n//=> 'https://travis-ci.org/jonschlinkert/micromatch'\n```\n\n### [.file](index.js#L258)\n\nCreate a URL for a file in a github repository.\n\n**Params**\n\n* `repository` **{String}**: Repository in the form of `owner/project-name` or full GitHub repository URL.\n* `branch` **{String}**: Optionally specify a branch\n* `path` **{String}**: Path to the file, relative to the repository root.\n* `returns` **{String}**\n\n**Example**\n\n```js\nrepo.file('https://github.com/jonschlinkert/micromatch', 'README.md');\n//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'\n\nrepo.raw('jonschlinkert/micromatch', 'README.md');\n//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'\n```\n\n### [.raw](index.js#L284)\n\nCreate a github \"raw\" content URL.\n\n**Params**\n\n* `repository` **{String}**: Repository in the form of `owner/project-name`\n* `options` **{Object|String}**: Options object or optional branch\n* `branch` **{String}**: Optionally specify a branch\n* `returns` **{String}**\n\n**Example**\n\n```js\nrepo.raw('https://github.com/jonschlinkert/micromatch', 'README.md');\n//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'\n\nrepo.raw('jonschlinkert/micromatch', 'README.md');\n//=> 'https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md'\n```\n\n### [.isGithubUrl](index.js#L307)\n\nReturn true if the given string looks like a github URL.\n\n**Params**\n\n* `str` **{String}**: URL to test\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\nutils.isGithubUrl('https://github.com/whatever');\n//=> true\nutils.isGithubUrl('https://foo.com/whatever');\n//=> false\n```\n\n### [.parseUrl](index.js#L345)\n\nParse a GitHub repository URL or repository `owner/project-name` into an object.\n\n**Params**\n\n* `repositoryURL` **{String}**: Full repository URL, or repository path in the form of `owner/project-name`\n* `options` **{Object}**\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\n// see the tests for supported formats\nrepo.parse('https://raw.githubusercontent.com/jonschlinkert/micromatch/master/README.md');\n\n// results in:\n{ protocol: 'https:',\n  slashes: true,\n  hostname: 'raw.githubusercontent.com',\n  host: 'raw.githubusercontent.com',\n  pathname: 'https://raw.githubusercontent.com/foo/bar/master/README.md',\n  path: '/foo/bar/master/README.md',\n  href: 'https://raw.githubusercontent.com/foo/bar/master/README.md',\n  owner: 'foo',\n  name: 'bar',\n  repo: 'foo/bar',\n  repository: 'foo/bar',\n  branch: 'master' }\n```\n\n### [.expandUrl](index.js#L407)\n\nParse 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.\n\n**Params**\n\n* `repository` **{String}**\n* `file` **{String}**: Optionally pass a repository file path.\n* `returns` **{String}**\n\n**Example**\n\n```js\n// see the tests for supported formats\nrepo.expand('https://github.com/abc/xyz.git', 'README.md');\n\n// results in:\n{ protocol: 'https:',\n  slashes: true,\n  hostname: 'github.com',\n  host: 'github.com',\n  pathname: 'https://github.com/abc/xyz.git',\n  path: '/abc/xyz.git',\n  href: 'https://github.com/abc/xyz.git',\n  owner: 'abc',\n  name: 'xyz',\n  repo: 'abc/xyz',\n  repository: 'abc/xyz',\n  branch: 'master',\n  host_api: 'api.github.com',\n  host_raw: 'https://raw.githubusercontent.com',\n  api: 'https://api.github.com/repos/abc/xyz',\n  tarball: 'https://api.github.com/repos/abc/xyz/tarball/master',\n  clone: 'https://github.com/abc/xyz',\n  zip: 'https://github.com/abc/xyz/archive/master.zip',\n  https: 'https://github.com/abc/xyz',\n  travis: 'https://travis-ci.org/abc/xyz',\n  file: 'https://github.com/abc/xyz/blob/master/README.md',\n  raw: 'https://raw.githubusercontent.com/abc/xyz/master/README.md' }\n```\n\n### [.gitConfigPath](index.js#L466)\n\nGet the local git config path, or global if a local `.git` repository does not exist.\n\n**Params**\n\n* `type` **{String}**: Pass `global` to get the global git config path regardless of whether or not a local repository exists.\n* `returns` **{String}**: Returns the local or global git path\n\n**Example**\n\n```js\nconsole.log(repo.gitConfigPath());\n//=> /Users/jonschlinkert/dev/repo-utils/.git/config\n\n// if local .git repo does not exist\nconsole.log(repo.gitConfigPath());\n/Users/jonschlinkert/.gitconfig\n\n// get global path\nconsole.log(repo.gitConfigPath('global'));\n/Users/jonschlinkert/.gitconfig\n```\n\n### [.gitConfig](index.js#L481)\n\nGet and parse global git config.\n\n**Params**\n\n* `options` **{Object}**: To get a local `.git` config, pass `{type: 'local'}`\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.gitConfig());\n```\n\n### [.owner](index.js#L527)\n\nGet an owner string from the given object or string.\n\n**Params**\n\n* `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.\n* `returns` **{String}**\n\n**Example**\n\n```js\nconsole.log(repo.owner(require('./package.json')));\n//=> 'jonschlinkert'\n```\n\n### [.person](index.js#L572)\n\nNormalize a \"person\" object. If a \"person\" string is passed (like `author`, `contributor` etc) it is parsed into an object, otherwise the object is returned.\n\n**Params**\n\n* `val` **{String|Object}**\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.person('Brian Woodward (https://github.com/doowb)'));\n//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }\nconsole.log(repo.person({ name: 'Brian Woodward', url: 'https://github.com/doowb' }));\n//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }\n```\n\n### [.author](index.js#L604)\n\nReturns an `author` object from the given given config object. If `config.author` is a string it will be parsed into an object.\n\n**Params**\n\n* `config` **{Object}**: Object with an `author` property\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.author({\n  author: 'Brian Woodward (https://github.com/doowb)'\n}));\n//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }\n\nconsole.log(repo.author({\n  name: 'Brian Woodward',\n  url: 'https://github.com/doowb'\n}));\n//=> { name: 'Brian Woodward', url: 'https://github.com/doowb' }\n```\n\n### [.authorName](index.js#L632)\n\nReturns the `author.name` from the given config object. If `config.author` is a string it will be parsed into an object first.\n\n**Params**\n\n* `config` **{Object}**: Object with an `author` property\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.authorName({\n  author: 'Brian Woodward (https://github.com/doowb)'\n}));\n//=> 'Brian Woodward'\n\nconsole.log(repo.authorName({\n  name: 'Brian Woodward',\n  url: 'https://github.com/doowb'\n}));\n//=> 'Brian Woodward'\n```\n\n### [.authorUrl](index.js#L657)\n\nReturns the `author.url` from the given config object. If `config.author` is a string it will be parsed into an object first.\n\n**Params**\n\n* `config` **{Object}**: Object with an `author` property\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.authorUrl({\n  author: 'Brian Woodward (https://github.com/doowb)'\n}));\n//=> 'https://github.com/doowb'\n\nconsole.log(repo.authorUrl({\n  name: 'Brian Woodward',\n  url: 'https://github.com/doowb'\n}));\n//=> 'https://github.com/doowb'\n```\n\n### [.authorEmail](index.js#L683)\n\nReturns the `author.email` from the given config object. If `config.author` is a string it will be parsed into an object first.\n\n**Params**\n\n* `config` **{Object}**: Object with an `author` property\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.authorEmail({\nauthor: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'\n}));\n//=> 'brian.woodward@sellside.com'\n\nconsole.log(repo.authorEmail({\n  name: 'Brian Woodward',\n  url: 'https://github.com/doowb',\nemail: 'brian.woodward@sellside.com'\n}));\n//=> 'brian.woodward@sellside.com'\n```\n\n### [.authorUsername](index.js#L709)\n\nReturns the `author.username` from the given config object. If `config.author` is a string it will be parsed into an object first.\n\n**Params**\n\n* `config` **{Object}**: Object with an `author` property\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.authorUsername({\nauthor: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'\n}));\n//=> 'doowb'\n\nconsole.log(repo.authorUsername({\n  name: 'Brian Woodward',\n  url: 'https://github.com/doowb',\nemail: 'brian.woodward@sellside.com'\n}));\n//=> 'doowb'\n```\n\n### [.username](index.js#L735)\n\nReturns a `username` from the given config object, by first attempting to get `author.username`, then\n\n**Params**\n\n* `config` **{Object}**: Object with an `author` property\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconsole.log(repo.username({\nauthor: 'Brian Woodward <brian.woodward@sellside.com> (https://github.com/doowb)'\n}));\n//=> 'doowb'\n\nconsole.log(repo.username({\n  name: 'Brian Woodward',\n  url: 'https://github.com/doowb',\nemail: 'brian.woodward@sellside.com'\n}));\n//=> 'doowb'\n```\n\n## Coverage\n\nAs of January 30, 2017:\n\n```\nStatements   : 88.99% ( 202/227 )\nBranches     : 79.69% ( 102/128 )\nFunctions    : 73.33% ( 22/30 )\nLines        : 88.99% ( 202/227 )\n```\n\n## About\n\n### Related projects\n\n* [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.\")\n* [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://github.com/jonschlinkert/parse-author) | [homepage](https://github.com/jonschlinkert/parse-author \"Parse a string into an object with `name`, `email` and `url` properties following npm conventions. Useful for the `authors` property in package.json or for parsing an AUTHORS file into an array of authors objects.\")\n* [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.\")\n* [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://github.com/jonschlinkert/project-name) | [homepage](https://github.com/jonschlinkert/project-name \"Get the name of a project, from package.json, git config, or basename of the current working directory.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 35 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 6 | [doowb](https://github.com/doowb) |\n| 1 | [tunnckoCore](https://github.com/tunnckoCore) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nMIT\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on January 30, 2017._","publish_time":1459130618138,"_cnpm_publish_time":1459130618138,"dist-tags":{"latest":"0.4.1"}}