flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
32
BACK_BACK/node_modules/relateurl/lib/parse/port.js
generated
vendored
Executable file
32
BACK_BACK/node_modules/relateurl/lib/parse/port.js
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
function parsePort(urlObj, options)
|
||||
{
|
||||
var defaultPort = -1;
|
||||
|
||||
for (var i in options.defaultPorts)
|
||||
{
|
||||
if ( i===urlObj.scheme && options.defaultPorts.hasOwnProperty(i) )
|
||||
{
|
||||
defaultPort = options.defaultPorts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultPort > -1)
|
||||
{
|
||||
// Force same type as urlObj.port
|
||||
defaultPort = defaultPort.toString();
|
||||
|
||||
if (urlObj.port === null)
|
||||
{
|
||||
urlObj.port = defaultPort;
|
||||
}
|
||||
|
||||
urlObj.extra.portIsDefault = (urlObj.port === defaultPort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = parsePort;
|
||||
Loading…
Add table
Add a link
Reference in a new issue