0.1.2 • Published 5 years ago

is-port v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

isPort

Build Status code style: prettier Downloads stability-stable

:white_check_mark: Check if a number is a valid port respecting the IANA Service Name and Transport Protocol Port Number Registry. Because I always forget if the last is 65535? 65534? xD.

Install

:coffee: Install latest Node.js stable version (or LTS) and then:

npm i -g is-port

Use

:pencil: More examples are provided in the test folder.

import { isPort } from "is-port";

console.log(isPort(5)); // true
console.log(isPort(10000000)); // false

Contributing

:sunglasses: If you wanted to help please take a look to this file.

API

:eyes: Full method definition.

isPort(port) -> valid

Checks if the passed number is a valid port.

  • port (number) - Candidate to check.
  • valid (boolean) - Result of the validation.