Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
parse-git-url
Advanced tools
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.
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}`);
The git-url-parse package provides similar functionality to parse-git-url, allowing you to parse Git URLs and extract their components. It also supports various Git URL formats and offers additional methods for manipulating and formatting Git URLs.
The parse-url package is a more general-purpose URL parser that can handle Git URLs among other types of URLs. It provides a comprehensive set of features for parsing, manipulating, and formatting URLs, making it a versatile alternative to parse-git-url.
The url-parse package is another general-purpose URL parser that can handle Git URLs. It offers a robust set of features for parsing and manipulating URLs, and it is widely used in the JavaScript ecosystem for various URL parsing needs.
A lib for parsing the URL of GitHub, GitHub Enterprise Server (ghes), GitLab, and Bitbucket repositories.
import parseGitUrl from 'parse-git-url'
parseGitUrl('https://github.com/vercel/swr'))
// => {
// type: 'github',
// owner: 'vercel',
// name: 'swr',
// branch: '',
// sha: '',
// subdir: ''
// }
parseGitUrl('https://github.example.com/vercel/swr', 'github.example.com'))
// => {
// type: 'ghes',
// owner: 'vercel',
// name: 'swr',
// branch: '',
// sha: '',
// subdir: ''
// }
parseGitUrl('https://google.com')
// => null
It supports parsing various URL schemas including SSH, branch, sha, commit, subdirectories, subgroups (GitLab), etc.
FAQs
A lib for parsing the URL of Git Repositories.
The npm package parse-git-url receives a total of 341,887 weekly downloads. As such, parse-git-url popularity was classified as popular.
We found that parse-git-url demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.