File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module.exports = function (string) {
6
6
var m = / ^ ( [ \w - ] + ) \/ ( [ \w - . ] + ) ( (?: # | @ ) .+ ) ? $ / . exec ( string )
7
7
if ( m ) return format ( m )
8
8
9
+ string = string . replace ( '//www.' , '//' )
9
10
// normalize git@ and https:git@ urls
10
11
string = string . replace ( / ^ g i t @ / , 'https://' )
11
12
string = string . replace ( / ^ h t t p s : g i t @ / , 'https://' )
Original file line number Diff line number Diff line change @@ -17,6 +17,18 @@ describe('versionless', function () {
17
17
assert . deepEqual ( [ 'component' , 'emitter' , '' ] , parse ( url ) )
18
18
} )
19
19
} )
20
+
21
+ it ( 'works for www.github.com' , function ( ) {
22
+ var url = 'https://www.github.com/component/emitter'
23
+ var parsed = parse ( url )
24
+ assert . deepEqual ( [ 'component' , 'emitter' , '' ] , parsed )
25
+ } )
26
+
27
+ it ( 'works for http://www.github.com' , function ( ) {
28
+ var url = 'http://www.github.com/component/emitter'
29
+ var parsed = parse ( url )
30
+ assert . deepEqual ( [ 'component' , 'emitter' , '' ] , parsed )
31
+ } )
20
32
} )
21
33
22
34
describe ( 'versioned' , function ( ) {
You can’t perform that action at this time.
0 commit comments