这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 19, 2019. It is now read-only.
/ is-port Public archive

✅ Check if a number is a valid port respecting the IANA Service Name and Transport Protocol Port Number Registry

License

Notifications You must be signed in to change notification settings

jesusprubio/is-port

isPort

Build Status code style: prettier Downloads stability-stable

✅ 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.

demo

🎁 Ping me on Twitter if you like this project

Install

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

npm i -g is-port

Use

📝 More examples are provided in the test folder.

import { isPort } from "is-port";

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

Contributing

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

API

👀 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.

About

✅ Check if a number is a valid port respecting the IANA Service Name and Transport Protocol Port Number Registry

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •