# package-repo

Give this function a package.json object, or a path to a package.json file. It will look for a `repository` or `repository.url` key in the given object and attempt to parse it as a GitHub or BitBucket repository URL. See [github-url-to-object](http://npm.im/github-url-to-object) and [bitbucket-url-to-object](http://npm.im/bitbucket-url-to-object) for details about the object returned.

## Installation

```sh
npm install package-repo --save
```

## Usage

```js
const packageRepo = require("package-repo")

packageRepo('./some/package.json')
// or
packageRepo(somePackage)

/*
{
  user: 'monkey',
  repo: 'business',
  branch: 'master',
  tarball_url: 'https://api.github.com/repos/monkey/business/tarball/master',
  clone_url: 'https://github.com/monkey/business',
  https_url: 'https://github.com/monkey/business',
  travis_url: 'https://travis-ci.org/monkey/business',
  api_url: 'https://api.github.com/repos/monkey/business'
  zip_url: 'https://github.com/monkey/business/archive/master.zip'
}
*/

```

## Tests

```sh
npm install
npm test
```

## Dependencies

- [bitbucket-url-to-object](https://github.com/zeke/bitbucket-url-to-object): Extract user, repo, and other interesting properties from Bitbucket URLs
- [github-url-to-object](https://github.com/zeke/github-url-to-object): Extract user, repo, and other interesting properties from GitHub URLs

## Dev Dependencies

- [chai](https://github.com/chaijs/chai): BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
- [mocha](https://github.com/mochajs/mocha): simple, flexible, fun test framework
- [require-dir](https://github.com/aseemk/requireDir): Helper to require() directories.
- [snazzy](https://github.com/feross/snazzy): Format JavaScript Standard Style as Stylish (i.e. snazzy) output


## License

MIT

_Generated by [package-json-to-readme](https://github.com/zeke/package-json-to-readme)_
