Sha256: 8459ab927b837d723d2e39a3b8e261b0965988d3dbda20ca283a14a84f492e0b

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

# 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

```javascript
var ngu = require('normalize-git-url');
var normalized = ngu("git+ssh://git@github.com:organization/repo.git#hashbrowns")
// get back:
// {
//   url : "ssh://git@github.com/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.

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
node-compiler-0.9.1 vendor/node/deps/npm/node_modules/normalize-git-url/README.md
node-compiler-0.9.0 vendor/node-v7.2.1/deps/npm/node_modules/normalize-git-url/README.md
node-compiler-0.8.0 vendor/node-v7.2.0/deps/npm/node_modules/normalize-git-url/README.md
node-compiler-0.7.0 vendor/node-v6.9.1/deps/npm/node_modules/normalize-git-url/README.md
node-compiler-0.7.0 vendor/node-v7.1.0/deps/npm/node_modules/normalize-git-url/README.md