Awesome
stringify-github-short-url
Generate Github / npm shorthand from list of arguments or object.
Install
npm i stringify-github-short-url --save
Usage
For more use-cases see the tests
const stringifyGithubShortUrl = require('stringify-github-short-url')
stringifyGithubShortUrl
Generate github / npm shorthand from list of arguments or object.
<owner>
{String|Object} user or org string, or object[name]
{String} repo name[branch]
{String} branch name[npm]
{String} passtrue
if you want to generate npm shorthandreturns
{String} generated shorthand
Example
const gh = require('stringify-github-short-url')
gh('jonschlinkert', 'micromatch') // => 'jonschlinkert/micromatch'
gh('jonschlinkert', 'micromatch', 'dev') // => 'jonschlinkert/micromatch#dev'
gh('gulpjs', 'gulp', 'v3.8.1', true) // => 'gulpjs/gulp@v3.8.1'
gh({
owner: 'tunnckoCore',
name: 'parse-function'
}) // => 'tunnckoCore/parse-function'
gh({
user: 'assemble',
repo: 'assemble-core'
}) // => 'assemble/assemble-core'
Related
- apidocs-cli: Command-line app for generating API docs from code comments. Can be used as API of
helper-apidocs
package. - gitclone-cli: Git clone github repository with pattern like
user/repo#branch
- parse-github-short-url: Parse a github/npm shorthand (user/repo#branch or user/repo@version) URL into an object.
- parse-github-url: Parse a github URL into an object.
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.