🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

parse-repo

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-repo

Extract repository info from a git remote URI

1.0.4
latest
Version published
Maintainers
1
Created

parse-repo

Extract repository information from a git remote URI.

Installation

npm install parse-repo

Usage

var parseRepo = require('parse-repo');

// parsing a GitHub https remote
parseRepo('https://github.com/npm/docs.git');
/*
{ remote: 'https://github.com/npm/docs.git',
  protocol: 'https',
  host: 'github.com',
  repository: 'npm/docs',
  owner: 'npm',
  project: 'docs' }
*/

// slightly different bitbucket URI
parseRepo('https://user@bitbucket.org/owner/org');
/*
{ remote: 'https://user@bitbucket.org/owner/org',
  protocol: 'https',
  host: 'bitbucket.org',
  repository: 'owner/org',
  owner: 'owner',
  project: 'org' }
*/

// git remotes are also supported
parseRepo('git@gitlab.com:gitlab-org/gitlab-ce.git');
/*
{ remote: 'git@gitlab.com:gitlab-org/gitlab-ce.git',
  protocol: 'git',
  host: 'gitlab.com',
  repository: 'gitlab-org/gitlab-ce',
  owner: 'gitlab-org',
  project: 'gitlab-ce' }
*/

// a local remote, without owner information
parseRepo('/local/path/repo-name');
/*
{ remote: '/local/path/repo-name',
  protocol: 'file',
  host: 'localhost',
  repository: 'repo-name',
  owner: null,
  project: 'repo-name' }
*/

License

MIT license - http://www.opensource.org/licenses/mit-license.php

FAQs

Package last updated on 03 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts