stringify-github-short-urls

2.0.0 • Public • Published

stringify-github-short-urls npmjs.com The MIT License

Stringify array of parse-github-short-url objects to shorthand.

code climate standard code style travis build status coverage status dependency status

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}: pass true if you want to generate npm shorthand
  • returns {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/gulp@v3.8.1']
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.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    1
  • 1.0.0
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i stringify-github-short-urls

Weekly Downloads

1

Version

2.0.0

License

MIT

Last publish

Collaborators

  • vanchoy
  • tunnckocore