Skip to content

Commit 2740cd6

Browse files
committed
[Fix] avoid node 22 url.parse deprecation warning
Fixes #30. Fixes #15.
1 parent bcca6b1 commit 2740cd6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function parse(str) {
6262

6363
if (!obj.host && (/^git@/).test(str) === true) {
6464
// return the correct host for git@ URLs
65-
obj.host = url.parse('http://' + str).host;
65+
obj.host = url.parse('http://' + str.replace(/git@([^:]+):/, '$1/')).host;
6666
}
6767

6868
obj.path = trimSlash(obj.path);

test/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ var test = require('tape');
55
var gh = require('../');
66

77
test('parse-github-url', function (t) {
8+
process.on('warning', function (e) {
9+
t.fail(e, 'no deprecation warnings are issued');
10+
});
11+
812
t.equal(gh('toString').href, 'toString');
913

1014
t.test('gets the user:', function (assert) {

0 commit comments

Comments
 (0)