Closed hancao97 closed 5 months ago
I has the same problem! 😢
Try this
allow_leading_zeroes: false
// isPort
import isInt from './isInt';
export default function isPort(str) {
return isInt(str, { allow_leading_zeroes: false, min: 0, max: 65535 });
}
This is the internal implementation of validatorjs, so I can't pass in options:
https://github.com/validatorjs/validator.js/blob/master/src/lib/isPort.js
At the same time, we need to think about how to configure the port format in 'isUrl'
This is the internal implementation of validatorjs, so I can't pass in options:
https://github.com/validatorjs/validator.js/blob/master/src/lib/isPort.js
At the same time, we need to think about how to configure the port format in 'isUrl'
This is the internal implementation of validatorjs, so I can't pass in options:
https://github.com/validatorjs/validator.js/blob/master/src/lib/isPort.js
I will create PR but seems like maintainers are not actively merging PRs, that's why I’ve suggested you edit your local version.
Describe the bug When I add 0 in front of a port string, just like ‘00065535’,I expect false,but the function return true.
Examples
Source Code: I can't configure the options of isInt when I use isPort api
Additional context Validator.js version: 13.7.7 Node.js version: v16.12.0 OS platform: macOS