main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
524 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | function parsePort(urlObj, options)
|
---|
4 | {
|
---|
5 | var defaultPort = -1;
|
---|
6 |
|
---|
7 | for (var i in options.defaultPorts)
|
---|
8 | {
|
---|
9 | if ( i===urlObj.scheme && options.defaultPorts.hasOwnProperty(i) )
|
---|
10 | {
|
---|
11 | defaultPort = options.defaultPorts[i];
|
---|
12 | break;
|
---|
13 | }
|
---|
14 | }
|
---|
15 |
|
---|
16 | if (defaultPort > -1)
|
---|
17 | {
|
---|
18 | // Force same type as urlObj.port
|
---|
19 | defaultPort = defaultPort.toString();
|
---|
20 |
|
---|
21 | if (urlObj.port === null)
|
---|
22 | {
|
---|
23 | urlObj.port = defaultPort;
|
---|
24 | }
|
---|
25 |
|
---|
26 | urlObj.extra.portIsDefault = (urlObj.port === defaultPort);
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 |
|
---|
31 |
|
---|
32 | module.exports = parsePort;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.