1. requires-port
Check if a protocol requires a certain port number to be added to an URL.
requires-port
Package: requires-port
Created by: unshiftio
Last modified: Sun, 26 Jun 2022 11:43:56 GMT
Version: 1.0.0
License: MIT
Downloads: 106,379,445
Repository: https://github.com/unshiftio/requires-port

Install

npm install requires-port
yarn add requires-port

requires-port

Made by unshiftVersion npmBuild StatusDependenciesCoverage StatusIRC channel

The module name says it all, check if a protocol requires a given port.

Installation

This module is intended to be used with browserify or Node.js and is distributed
in the public npm registry. To install it simply run the following command from
your CLI:

npm install --save requires-port

Usage

The module exports it self as function and requires 2 arguments:

  1. The port number, can be a string or number.
  2. Protocol, can be http, http: or even https://yomoma.com. We just split
    it at : and use the first result. We currently accept the following
    protocols:
    • http
    • https
    • ws
    • wss
    • ftp
    • gopher
    • file

It returns a boolean that indicates if protocol requires this port to be added
to your URL.

 'use strict';

var required = require('requires-port');

console.log(required('8080', 'http')) // true
console.log(required('80', 'http'))   // false

License

MIT

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code