diff --git a/.verb.md b/.verb.md index f8e4805..00370d6 100644 --- a/.verb.md +++ b/.verb.md @@ -12,6 +12,18 @@ Seems like every lib I've found does too much, like both stringifying and parsin ```js var gh = require('{%= name %}'); +gh('https://github.com/jonschlinkert/micromatch'); +``` + +Results in: + +```js +{ + "user": "jonschlinkert", + "repo": "micromatch", + "repopath": "jonschlinkert/micromatch", + "branch": "master" +} ``` ## Example results diff --git a/README.md b/README.md index 8a2724e..ad9781e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # parse-github-url [![NPM version](https://badge.fury.io/js/parse-github-url.svg)](http://badge.fury.io/js/parse-github-url) [![Build Status](https://travis-ci.org/jonschlinkert/parse-github-url.svg)](https://travis-ci.org/jonschlinkert/parse-github-url) + > Parse a github URL into an object. **Why another GitHub URL parser library?** @@ -16,6 +17,18 @@ npm i parse-github-url --save ```js var gh = require('parse-github-url'); +gh('https://github.com/jonschlinkert/micromatch'); +``` + +Results in: + +```js +{ + "user": "jonschlinkert", + "repo": "micromatch", + "repopath": "jonschlinkert/micromatch", + "branch": "master" +} ``` ## Example results @@ -297,24 +310,27 @@ Generated results from test fixtures: ``` ## Related projects -* [is-git-url](https://github.com/jonschlinkert/is-git-url): Regex to validate that a URL is a git url. +[is-git-url](https://github.com/jonschlinkert/is-git-url): Regex to validate that a URL is a git url. ## Running tests -Install dev dependencies. +Install dev dependencies: ```bash npm i -d && npm test ``` + ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-github-url/issues) + ## Author **Jon Schlinkert** - -+ [github/jonschlinkert](https://github.com/jonschlinkert) -+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + + + [github/jonschlinkert](https://github.com/jonschlinkert) + + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + ## License Copyright (c) 2015 Jon Schlinkert @@ -322,4 +338,4 @@ Released under the MIT license *** -_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 14, 2015._ \ No newline at end of file +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 25, 2015._ diff --git a/test.js b/test.js index 5f6c7fe..80aa844 100644 --- a/test.js +++ b/test.js @@ -8,6 +8,8 @@ var o; describe('parse-github-url', function () { it('should get the user:', function () { assert.equal(gh(''), null); + assert.equal(gh('https://github.com/jonschlinkert/micromatch').user, 'jonschlinkert'); + assert.equal(gh('git@github.com:assemble/verb.git').user, 'assemble'); assert.equal(gh('assemble/verb#branch').user, 'assemble'); assert.equal(gh('assemble/verb#dev').user, 'assemble'); assert.equal(gh('assemble/verb').user, 'assemble');