MCPcopy Create free account
hub / github.com/chunshand/qdev / isIPv4

Function isIPv4

admin/src/utils/validate.ts:73–77  ·  view source on GitHub ↗
(ip: string)

Source from the content-addressed store, hash-verified

71
72/** 判断是否为 IPv4 地址 */
73export const isIPv4 = (ip: string) => {
74 const reg =
75 /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/
76 return reg.test(ip)
77}
78
79/** 判断是否为车牌(兼容新能源车牌) */
80export const isLicensePlate = (str: string) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected