Socket
Socket
Sign inDemoInstall

github-url-to-object

Package Overview
Dependencies
1
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-url-to-object


Version published
Maintainers
1
Install size
11.7 kB
Created

Readme

Source

github-url-to-object

Extract username and repo name from various flavors of GitHub URLs.

Installation

npm install github-url-to-object --save

Usage

Pass whatever flavor of github URL you like:

var gh = require('github-url-to-object')

gh('user/repo')
gh('https://github.com/monkey/business')
gh('https://github.com/monkey/business.git')
gh('http://github.com/monkey/business')
gh('git://github.com/monkey/business.git')

Here's what you'll get back:

{
  user: 'monkey',
  repo: 'business'
}

If you provide a non-github URL or a falsy value, you'll get null back.

Test

npm test

License

WTFPL

Keywords

FAQs

Last updated on 16 Apr 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc