# bitbucket-url-from-git

> Parse a bitbucket git url and return the bitbucket repo url

Latest version **1.0.2** (published 2019-04-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install bitbucket-url-from-git
pnpm add bitbucket-url-from-git
yarn add bitbucket-url-from-git
bun add bitbucket-url-from-git
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-04-14 |
| First published | 2018-03-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alex Leon |
| Maintainers | alex-e-leon |
| Keywords | bitbucket, git, url, parser |

## Links

- npm: https://www.npmjs.com/package/bitbucket-url-from-git
- Repository: https://github.com/alex-e-leon/bitbucket-url-from-git
- Homepage: https://github.com/alex-e-leon/bitbucket-url-from-git#readme
- Issues: https://github.com/alex-e-leon/bitbucket-url-from-git/issues
- npm.io page: https://npm.io/package/bitbucket-url-from-git

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-04-14
- 1.0.1 — 2019-04-14
- 1.0.0 — 2018-03-13

## README

# bitbucket-url-from-git

Blatantly ripped off [tj/node-github-url-from-git](https://github.com/tj/node-github-url-from-git)
But tweaked for bitbucket urls


```js
describe('parse(url)', function () {
  it('should support git://*', function () {
    var url = 'git@bitbucket.org:alex-e-leon/node-bitbucket-url-from-git.git'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should support git://*.git', function () {
    var url = 'git://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git.git'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should support https://*', function () {
    var url = 'https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should support https://*.git', function () {
    var url = 'https://alex@bitbucket.org/alex-e-leon/node-bitbucket-url-from-git.git'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should return undefined on failure', function () {
    var url = 'git://bitbucket.org/alex-e-leon/.git'
    assert(parse(url) == null)
  })

  it('should parse git@bitbucket.org:/alex-e-leon/node-bitbucket-url-from-git.git', function () {
    var url = 'git@bitbucket.org:/alex-e-leon/node-bitbucket-url-from-git.git'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should parse git@github.com:bcoe/thumbd.git#2.7.0', function () {
    var url = 'git@bitbucket.org:alex-e-leon/node-bitbucket-url-from-git.git#2.7.0'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should parse git+https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git.git', function () {
    var url = 'git+https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git.git'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should parse git+ssh://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git.git', function () {
    var url = 'git+ssh://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git.git'
    parse(url).should.eql('https://bitbucket.org/alex-e-leon/node-bitbucket-url-from-git')
  })

  // snippet urls.

  it('should parse git@ snippet urls', function () {
    var url = 'git@bitbucket.org:snippets/alex-e-leon/nepk84/a-snippet.git'
    parse(url).should.equal('https://bitbucket.org/snippets/alex-e-leon/nepk84')
  })

  it('should parse https://gist urls', function () {
    var url = 'https://alex@bitbucket.org/snippets/alex-e-leon/nepk84/a-snippet.git'
    parse(url).should.equal('https://bitbucket.org/snippets/alex-e-leon/nepk84')
  })

  // Handle arbitrary GitHub Enterprise domains.

  it('should parse parse extra bitbucket enterprise urls provided', function () {
    var url = 'git://bitbucket.example.com/alex-e-leon/node-bitbucket-url-from-git.git'
    parse(
      url, {extraBaseUrls: ['bitbucket.example.com']}
    ).should.equal('https://bitbucket.example.com/alex-e-leon/node-bitbucket-url-from-git')
  })

  it('should parse bitbucket enterprise urls with multiple subdomains', function () {
    var url = 'git://bitbucket.internal.example.com/alex-e-leon/node-bitbucket-url-from-git.git'
    parse(
      url, {extraBaseUrls: ['bitbucket.internal.example.com']}
    ).should.equal('https://bitbucket.internal.example.com/alex-e-leon/node-bitbucket-url-from-git')
  })
})
```

---
_Source: https://npm.io/package/bitbucket-url-from-git · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
