github-url-from-git
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -24,3 +24,3 @@ // convert git:// form url to github URL, e.g., | ||
return new RegExp( | ||
/^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?/.source + | ||
/^(?:https?:\/\/|git:\/\/|git\+ssh:\/\/|git\+https:\/\/)?(?:[^@]+@)?/.source + | ||
'(' + baseUrls.join('|') + ')' + | ||
@@ -27,0 +27,0 @@ /[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source |
{ | ||
"name": "github-url-from-git", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Parse a github git url and return the github repo url", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -41,2 +41,12 @@ | ||
it('should parse git+https://github.com/bcoe/thumbd.git', function() { | ||
var url = 'git+https://github.com/bcoe/thumbd.git'; | ||
parse(url).should.eql('https://github.com/bcoe/thumbd'); | ||
}) | ||
it('should parse git+ssh://github.com/bcoe/thumbd.git', function() { | ||
var url = 'git+ssh://github.com/bcoe/thumbd.git'; | ||
parse(url).should.eql('https://github.com/bcoe/thumbd'); | ||
}) | ||
it('should parse https://EastCloud@github.com/EastCloud/node-websockets.git', function() { | ||
@@ -43,0 +53,0 @@ var url = 'https://EastCloud@github.com/EastCloud/node-websockets.git'; |
12
test.js
@@ -40,2 +40,12 @@ var parse = require('./'); | ||
it('should parse git+https://github.com/bcoe/thumbd.git', function() { | ||
var url = 'git+https://github.com/bcoe/thumbd.git'; | ||
parse(url).should.eql('https://github.com/bcoe/thumbd'); | ||
}) | ||
it('should parse git+ssh://github.com/bcoe/thumbd.git', function() { | ||
var url = 'git+ssh://github.com/bcoe/thumbd.git'; | ||
parse(url).should.eql('https://github.com/bcoe/thumbd'); | ||
}) | ||
it('should parse https://EastCloud@github.com/EastCloud/node-websockets.git', function() { | ||
@@ -78,5 +88,5 @@ var url = 'https://EastCloud@github.com/EastCloud/node-websockets.git'; | ||
parse.re.source.should.equal( | ||
/^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source | ||
/^(?:https?:\/\/|git:\/\/|git\+ssh:\/\/|git\+https:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source | ||
) | ||
}); | ||
}) |
9134
102
93