Skip to content

Commit

Permalink
Revert "Fix issue #56"
Browse files Browse the repository at this point in the history
This reverts commit b33b399.
  • Loading branch information
pvdlg committed Jul 9, 2018
1 parent c4dfff9 commit e58ee36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 5 additions & 4 deletions lib/index.js
@@ -1,7 +1,6 @@
"use strict";

const gitUp = require("git-up");
const parseDomain = require('parse-domain');

/**
* gitUrlParse
Expand Down Expand Up @@ -45,12 +44,14 @@ function gitUrlParse(url) {
, splits = null
;

urlInfo.toString = function (type) {
urlInfo.toString = function (type) {
return gitUrlParse.stringify(this, type);
};

const parsedResource = parseDomain(urlInfo.resource)
urlInfo.source = parsedResource.domain + '.' + parsedResource.tld;
urlInfo.source = sourceParts.length > 2
? sourceParts.slice(-2).join(".")
: urlInfo.source = urlInfo.resource
;

// Note: Some hosting services (e.g. Visual Studio Team Services) allow whitespace characters
// in the repository and owner names so we decode the URL pieces to get the correct result
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -29,8 +29,7 @@
"test": "test"
},
"dependencies": {
"git-up": "^2.0.0",
"parse-domain": "^2.0.0"
"git-up": "^2.0.0"
},
"devDependencies": {
"browserify": "^13.0.1",
Expand Down
5 changes: 0 additions & 5 deletions test/index.js
Expand Up @@ -280,9 +280,4 @@ tester.describe("parse urls", test => {
res.user = "user";
test.expect(res.toString()).toBe("http://user@github.com/owner/name.git");
});

test.should("custom url", () => {
var res = gitUrlParse("https://git.test.com.cn/a/b");
test.expect(res.source).toBe('test.com.cn');
})
});

0 comments on commit e58ee36

Please sign in to comment.