original
Advanced tools
Comparing version 0.0.3 to 0.0.4
11
index.js
@@ -15,3 +15,3 @@ 'use strict'; | ||
var defaultport | ||
var noport | ||
, protocol = url.protocol | ||
@@ -28,7 +28,8 @@ , port = url.port && +url.port; | ||
!port | ||
|| (80 === port && (protocol === 'http:' || protocol === 'ws:')) | ||
|| (443 === port && (protocol === 'https:' || protocol === 'wss:')) | ||
) defaultport = true; | ||
|| 'file:' === protocol | ||
|| (80 === port && ('http:' === protocol || 'ws:' === protocol )) | ||
|| (443 === port && ('https:' === protocol || 'wss:' === protocol)) | ||
) noport = true; | ||
return url.protocol +'//'+ url.hostname + (defaultport ? '' : ':'+ port); | ||
return url.protocol +'//'+ url.hostname + (noport ? '' : ':'+ port); | ||
} | ||
@@ -35,0 +36,0 @@ |
{ | ||
"name": "original", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Generate the origin from an URL or check if two URL/Origins are the same", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,2 +36,5 @@ describe('original', function () { | ||
assume(o).equals('https://google.com:80'); | ||
o = origin('file://google.com/pathname'); | ||
assume(o).equals('file://google.com'); | ||
}); | ||
@@ -38,0 +41,0 @@ |
5420
89