stringify-github-short-urls
v2.0.0
Published
Stringify array of `parse-github-short-url` objects to shorthand.
Downloads
2
Readme
stringify-github-short-urls
Stringify array of
parse-github-short-url
objects to shorthand.
Install
npm i stringify-github-short-urls --save
Usage
For more use-cases see the tests
const stringifyGithubShortUrls = require('stringify-github-short-urls')
stringifyGithubShortUrls
Stringify object or list of arguments to Github / npm shorthand.
Params
<owner>
{Array|String|Object}: user or org string, or object, array of objects[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-urls')
// same as `stringify-github-short-url`
gh('jonschlinkert', 'micromatch') // => ['jonschlinkert/micromatch']
gh('jonschlinkert', 'micromatch', 'dev') // => ['jonschlinkert/micromatch#dev']
gh('gulpjs', 'gulp', 'v3.8.1', true) // => ['gulpjs/[email protected]']
gh({
owner: 'tunnckoCore',
name: 'parse-function'
}) // => ['tunnckoCore/parse-function']
gh({
user: 'assemble',
repo: 'assemble-core'
}) // => ['assemble/assemble-core']
// or accept arrays of objects that are passed to `stringify-github-short-url`
gh([
{owner: 'assemble', name: 'assemble-core'},
{owner: 'jonschlinkert', name: 'micromatch', branch: 'dev'}
]) // => ['assemble/assemble-core', 'jonschlinkert/micromatch#dev']
Related
- gitclone-cli: Git clone github repository with pattern like
user/repo#branch
- parse-function: Parse a function, arrow function or string to object with name, args, params and body properties.
- 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.
- stringify-github-short-url: Generate Github / npm shorthand from list of arguments or 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.