Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/parse-gh-branch-identifier
Parse a branch identifier string that is available for Github commit comparison API
https://github.com/shinnn/parse-gh-branch-identifier
Last synced: 27 days ago
JSON representation
Parse a branch identifier string that is available for Github commit comparison API
- Host: GitHub
- URL: https://github.com/shinnn/parse-gh-branch-identifier
- Owner: shinnn
- License: mit
- Created: 2016-01-21T11:48:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-25T09:03:30.000Z (almost 8 years ago)
- Last Synced: 2024-10-13T17:29:21.279Z (about 1 month ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parse-gh-branch-identifier
[![NPM version](https://img.shields.io/npm/v/parse-gh-branch-identifier.svg)](https://www.npmjs.com/package/parse-gh-branch-identifier)
[![Bower version](https://img.shields.io/bower/v/parse-gh-branch-identifier.svg)](https://github.com/shinnn/parse-gh-branch-identifier/releases)
[![Build Status](https://travis-ci.org/shinnn/parse-gh-branch-identifier.svg)](https://travis-ci.org/shinnn/parse-gh-branch-identifier)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/parse-gh-branch-identifier.svg)](https://coveralls.io/github/shinnn/parse-gh-branch-identifier?branch=master)
[![Dependency Status](https://david-dm.org/shinnn/parse-gh-branch-identifier.svg)](https://david-dm.org/shinnn/parse-gh-branch-identifier)
[![devDependency Status](https://david-dm.org/shinnn/parse-gh-branch-identifier/dev-status.svg)](https://david-dm.org/shinnn/parse-gh-branch-identifier#info=devDependencies)Parse a branch identifier string that is available for [Github](https://github.com/) [commit comparison API](https://developer.github.com/v3/repos/commits/#compare-two-commits)
## Installation
### Package managers
#### [npm](https://www.npmjs.com/)
```
npm install parse-gh-branch-identifier
```#### [Bower](http://bower.io/)
```
bower install parse-gh-branch-identifier
```### Standalone
[Download the script file directly.](https://raw.githubusercontent.com/shinnn/parse-gh-branch-identifier/master/browser.js)
## API
### parseGhBranchIdentifier(*str*)
*str*: `String` (`branch` or `username:branch` style string)
Return: `Object` (`{[username: ...,] branch: ...}`)It extracts a branch name (and username if available) from a `branch` or `username:branch` string and creates an object.
```javascript
parseGhBranchIdentifier('patch-1');
//=> {branch: 'patch-1'}parseGhBranchIdentifier('shinnn:patch-1');
//=> {username: 'shinnn', branch: 'patch-1'}
```## License
Copyright (c) 2016 [Shinnosuke Watanabe](https://github.com/shinnn)
Licensed under [the MIT License](./LICENSE).