\href{http://unshift.io}{\texttt{ }}\href{http://browsenpm.org/package/requires-port}{\texttt{ }}\href{https://travis-ci.org/unshiftio/requires-port}{\texttt{ }}\href{https://david-dm.org/unshiftio/requires-port}{\texttt{ }}\href{https://coveralls.io/r/unshiftio/requires-port?branch=master}{\texttt{ }}\href{http://webchat.freenode.net/?channels=unshift}{\texttt{ }}

The module name says it all, check if a protocol requires a given port.\hypertarget{md_sfcode_node_modules_requires_port_README_autotoc_md24366}{}\doxysection{Installation}\label{md_sfcode_node_modules_requires_port_README_autotoc_md24366}
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\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install -\/-\/save requires-\/port }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_requires_port_README_autotoc_md24367}{}\doxysection{Usage}\label{md_sfcode_node_modules_requires_port_README_autotoc_md24367}
The module exports it self as function and requires 2 arguments\+:


\begin{DoxyEnumerate}
\item The port number, can be a string or number.
\item Protocol, can be {\ttfamily http}, {\ttfamily http\+:} or even {\ttfamily \href{https://yomoma.com}{\texttt{ https\+://yomoma.\+com}}}. We just split it at {\ttfamily \+:} and use the first result. We currently accept the following protocols\+:
\begin{DoxyItemize}
\item {\ttfamily http}
\item {\ttfamily https}
\item {\ttfamily ws}
\item {\ttfamily wss}
\item {\ttfamily ftp}
\item {\ttfamily gopher}
\item {\ttfamily file}
\end{DoxyItemize}
\end{DoxyEnumerate}

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


\begin{DoxyCode}{0}
\DoxyCodeLine{'use strict';}
\DoxyCodeLine{}
\DoxyCodeLine{var required = require('requires-\/port');}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(required('8080', 'http')) // true}
\DoxyCodeLine{console.log(required('80', 'http'))   // false }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_requires_port_README_autotoc_md24368}{}\doxysection{License}\label{md_sfcode_node_modules_requires_port_README_autotoc_md24368}
MIT 