✅ 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.
🎁 Ping me on Twitter if you like this project
☕ Install latest Node.js stable version (or LTS) and then:
npm i -g is-port📝 More examples are provided in the test folder.
import { isPort } from "is-port";
console.log(isPort(5)); // true
console.log(isPort(10000000)); // false😎 If you wanted to help please take a look to this file.
👀 Full method definition.
Checks if the passed number is a valid port.
port(number) - Candidate to check.valid(boolean) - Result of the validation.