1234567891011121314151617181920212223242526272829303132333435363738 |
- 'use strict';
- module.exports = function required(port, protocol) {
- protocol = protocol.split(':')[0];
- port = +port;
- if (!port) return false;
- switch (protocol) {
- case 'http':
- case 'ws':
- return port !== 80;
- case 'https':
- case 'wss':
- return port !== 443;
- case 'ftp':
- return port !== 21;
- case 'gopher':
- return port !== 70;
- case 'file':
- return false;
- }
- return port !== 0;
- };
|