github-url-to-object
Advanced tools
Comparing version 0.7.1 to 1.0.0
@@ -13,2 +13,3 @@ "use strict" | ||
var shorthand = repo_url.match(/^([\w-_]+)\/([\w-_\.]+)#?([\w-_\.]+)?$/) | ||
var mediumhand = repo_url.match(/^github:([\w-_]+)\/([\w-_\.]+)#?([\w-_\.]+)?$/) | ||
var antiquated = repo_url.match(/^git@[\w-_\.]+:([\w-_]+)\/([\w-_\.]+)$/) | ||
@@ -20,2 +21,6 @@ | ||
obj.branch = shorthand[3] || "master" | ||
} else if (mediumhand) { | ||
obj.user = mediumhand[1] | ||
obj.repo = mediumhand[2] | ||
obj.branch = mediumhand[3] || "master" | ||
} else if (antiquated) { | ||
@@ -22,0 +27,0 @@ obj.user = antiquated[1] |
{ | ||
"name": "github-url-to-object", | ||
"version": "0.7.1", | ||
"version": "1.0.0", | ||
"description": "Extract user, repo, and other interesting properties from GitHub URLs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,2 +22,3 @@ # github-url-to-object [![Build Status](https://travis-ci.org/zeke/github-url-to-object.png?branch=master)](https://travis-ci.org/zeke/github-url-to-object) | ||
gh('monkey/business') | ||
gh('github:monkey/business') | ||
gh('https://github.com/monkey/business') | ||
@@ -24,0 +25,0 @@ gh('https://github.com/monkey/business.git') |
@@ -31,2 +31,31 @@ var mocha = require("mocha") | ||
describe("mediumhand", function(){ | ||
it("supports github:user/repo style", function(){ | ||
var obj = gh("user/repo#branch") | ||
assert.equal(obj.user, 'user') | ||
assert.equal(obj.repo, 'repo') | ||
}) | ||
it("supports github:user/repo#branch style", function(){ | ||
var obj = gh("user/repo#branch") | ||
assert.equal(obj.user, 'user') | ||
assert.equal(obj.repo, 'repo') | ||
assert.equal(obj.branch, 'branch') | ||
}) | ||
it("defaults to master branch", function(){ | ||
var obj = gh("github:user/repo") | ||
assert.equal(obj.user, 'user') | ||
assert.equal(obj.repo, 'repo') | ||
assert.equal(obj.branch, 'master') | ||
}) | ||
it("rejects bitbucket", function(){ | ||
var obj = gh("bitbucket:user/repo") | ||
assert.equal(obj, null) | ||
}) | ||
}) | ||
describe("oldschool", function(){ | ||
@@ -33,0 +62,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8807
186
1
68