Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-git-url

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-git-url

A lib for parsing the URL of Git Repositories.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
429K
increased by15.22%
Maintainers
6
Weekly downloads
 
Created

What is parse-git-url?

The parse-git-url npm package is a utility for parsing Git URLs into their component parts. It supports various Git URL formats and provides a simple interface to extract information such as the protocol, host, owner, name, and more.

What are parse-git-url's main functionalities?

Parse Git URL

This feature allows you to parse a Git URL and extract its components. The code sample demonstrates how to parse a Git URL and log the parsed object, which includes properties like protocol, host, owner, and name.

const parseGitUrl = require('parse-git-url');
const parsed = parseGitUrl('https://github.com/user/repo.git');
console.log(parsed);

Support for Different Git URL Formats

This feature shows the package's ability to handle different Git URL formats, such as SSH and HTTPS. The code sample demonstrates parsing both an SSH URL and an HTTPS URL, logging the parsed objects for each.

const parseGitUrl = require('parse-git-url');
const sshUrl = parseGitUrl('git@github.com:user/repo.git');
const httpsUrl = parseGitUrl('https://github.com/user/repo.git');
console.log(sshUrl);
console.log(httpsUrl);

Extract Specific Components

This feature allows you to extract specific components from a parsed Git URL. The code sample demonstrates how to extract and log the owner and repository name from a parsed Git URL.

const parseGitUrl = require('parse-git-url');
const parsed = parseGitUrl('https://github.com/user/repo.git');
const owner = parsed.owner;
const name = parsed.name;
console.log(`Owner: ${owner}, Repo Name: ${name}`);

Other packages similar to parse-git-url

FAQs

Package last updated on 17 Oct 2023

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc