normalize-git-url

WebJar for normalize-git-url

License

License

ISC
Categories

Categories

Git Development Tools Version Controls ORM Data
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

normalize-git-url
Last Version

Last Version

3.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

normalize-git-url
WebJar for normalize-git-url
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/npm/normalize-git-url

Download normalize-git-url

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/normalize-git-url/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>normalize-git-url</artifactId>
    <version>3.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/normalize-git-url/
implementation 'org.webjars.npm:normalize-git-url:3.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/normalize-git-url/
implementation ("org.webjars.npm:normalize-git-url:3.0.2")
'org.webjars.npm:normalize-git-url:jar:3.0.2'
<dependency org="org.webjars.npm" name="normalize-git-url" rev="3.0.2">
  <artifact name="normalize-git-url" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='normalize-git-url', version='3.0.2')
)
libraryDependencies += "org.webjars.npm" % "normalize-git-url" % "3.0.2"
[org.webjars.npm/normalize-git-url "3.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

normalize-git-url

You have a bunch of Git URLs. You want to convert them to a canonical representation, probably for use inside npm so that it doesn't end up creating a bunch of superfluous cached origins. You use this package.

Usage

var ngu = require('normalize-git-url');
var normalized = ngu("git+ssh://[email protected]:organization/repo.git#hashbrowns")
// get back:
// {
//   url : "ssh://[email protected]/organization/repo.git",
//   branch : "hashbrowns" // did u know hashbrowns are delicious?
// }

API

There's just the one function, and all it takes is a single parameter, a non-normalized Git URL.

normalizeGitUrl(url)

  • url {String} The Git URL (very loosely speaking) to be normalized.

Returns an object with the following format:

  • url {String} The normalized URL.
  • branch {String} The treeish to be checked out once the repo at url is cloned. It doesn't have to be a branch, but it's a lot easier to intuit what the output is for with that name.

Limitations

Right now this doesn't try to special-case GitHub too much -- it doesn't ensure that .git is added to the end of URLs, it doesn't prefer https: over http: or ssh:, it doesn't deal with redirects, and it doesn't try to resolve symbolic names to treeish hashcodes. For now, it just tries to account for minor differences in representation.

org.webjars.npm

npm

node package manager

Versions

Version
3.0.2
3.0.1