JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31480
  • Score
    100M100P100Q130605F
  • License MIT

Parse and stringify git urls in a friendly way.

Package Exports

  • git-source

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (git-source) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

git-source PayPal Version Downloads Get help on Codementor

Parse and stringify git urls in a friendly way.

Installation

$ npm i --save git-source

Example

const gitSource = require("git-source");

console.log(gitSource("owner/repo"));
// { protocols: [ 'https' ],
//   protocol: 'https',
//   port: null,
//   resource: 'github.com',
//   user: '',
//   pathname: '/owner/repo',
//   hash: '',
//   search: '',
//   href: 'https://github.com/owner/repo',
//   token: '',
//   toString: [Function],
//   source: 'github.com',
//   name: 'repo',
//   owner: 'owner',
//   organization: '',
//   full_name: 'owner/repo' }

console.log(gitSource("owner/repo").toString());
// https://github.com/owner/repo

console.log(gitSource("gist:id").toString());
// https://gist.github.com/id

console.log(gitSource("gist:owner/id").toString());
// https://gist.github.com/owner/id

console.log(gitSource("bitbucket:owner/repo").toString("ssh"));
// git@bitbucket.org:owner/repo.git

console.log(gitSource("git@github.com:IonicaBizau/git-url-parse.git"));
// { protocols: [],
//   protocol: 'ssh',
//   port: null,
//   resource: 'github.com',
//   user: 'git',
//   pathname: '/IonicaBizau/git-url-parse.git',
//   hash: '',
//   search: '',
//   href: 'git@github.com:IonicaBizau/git-url-parse.git',
//   token: '',
//   toString: [Function],
//   source: 'github.com',
//   name: 'git-url-parse',
//   owner: 'IonicaBizau',
//   organization: 'git',
//   full_name: 'IonicaBizau/git-url-parse' }

How to contribute

Have an idea? Found a bug? See how to contribute.

Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

License

MIT © Ionică Bizău