UNPKG

validlyjs

Version:

A high-performance Laravel-inspired validation library for TypeScript/JavaScript

5 lines (4 loc) 234 B
"use strict" exports.portRule={name:"network.port",validate:e=>{if("number"!=typeof e&&"string"!=typeof e)return!1 const t=parseInt(e,10) return!isNaN(t)&&t>=0&&65535>=t},message:"The {field} must be a valid port number.",priority:2}