Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 39x 465x 39x 426x 633x 469x 164x 3x 161x 1x 160x 63x 1x 62x 3x 1x 2x 3x 2x 200x 160x 40x 37x 3x 465x 23x 2x 21x 2x 461x |
export function isValidIPAddress(value?: string|null) {
function isValidIPAddressString(ipAddress: string) {
return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipAddress);
}
if (value && value.length)
return isValidIPAddressString(value);
return true;
}
export function isValidDocumentIdForYup(value: any) {
if (typeof value == 'undefined')
return true;
if (typeof value != 'string' && typeof value != 'number')
return false;
if (typeof value == 'string' && value.length == 0)
return false;
return true;
}
export function isValidHttpMethod(value?: string|null) {
if (value && !['GET', 'POST', 'PUT', 'DELETE'].includes(value))
return false;
return true;
}
export function isValidBodyType(value?: string) {
if (value && !['json', 'form-data'].includes(value))
return false;
return true;
}
export function isTruthyString(value: string) {
if (typeof value != 'string') return false;
return value && value.length > 0;
}
export function isValidIntegerForYup(value?: number | null) {
if (typeof value == 'undefined')
return true;
if (typeof value == 'number')
return Number.isInteger(value);
return false;
}
export function validateSessionIdGenerator(value: any) {
if (value) {
if (typeof value != 'function')
return false;
if (typeof value() != 'string')
return false;
}
return true;
}
|