JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 30460
  • Score
    100M100P100Q128745F
  • 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

Patreon PayPal AMA 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.

💰 Donations

Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. 🚀

PayPal donations are appreciated too! Each dollar helps.

Thanks! ❤️

💫 Where is this library used?

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

  • gh-fork-source—Get the source repository of a GitHub fork.
  • git-cloner—Clone multiple git repositories.
  • gpm—npm + git = gpm - Install NPM packages and dependencies from git repositories.
  • package.json—Get the package.json content either from npm or from a git repository.
  • pkg.json—Get the package.json content either from npm or from a git repository.

📜 License

MIT © Ionică Bizău