import { isHexString , isBytes , isNumberString , isSInt64 , isUInt64 , isUInt32 , isSInt32 , isIP , isIPV4 , isEncryptedPassphrase , isSemVer , } from './validation' ; export const hex = isHexString ; export const bytes = isBytes ; export const int64 = ( data ) : boolean => isNumberString ( data ) && isSInt64 ( BigInt ( data ) ) ; export const uint64 = ( data ) : boolean => isNumberString ( data ) && isUInt64 ( BigInt ( data ) ) ; export const uint32 = ( data ) : boolean => isNumberString ( data ) && isUInt32 ( Number ( data ) ) ; export const int32 = ( data ) : boolean => isNumberString ( data ) && isSInt32 ( Number ( data ) ) ; const camelCaseRegex = /^[a-z]+((\d)|([A-Z0-9][a-zA-Z0-9]+))*([a-z0-9A-Z])?$/ ; export const camelCase = ( data ) : boolean => camelCaseRegex . exec ( data ) !== null ; export const version = isSemVer ; export const networkVersion = ( data ) : boolean => /^(\d|[1-9]\d{1,2})\.(\d|[1-9]\d{1,2})$/ . test ( data ) ; export const path = ( data ) : boolean => /^(.?)(\/[^/]+)+(\/?)$/ . test ( data ) ; export const encryptedPassphrase = isEncryptedPassphrase ; export const ip = isIP ; export const ipOrFQDN = ( data ) : boolean => { const hostnameRegex = /^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$/ ; return isIPV4 ( data ) || hostnameRegex . test ( data ) ; } ; export const oddInteger = ( data ) : boolean => { if ( typeof data === 'number' ) { return Number . isInteger ( data ) && data % 2 === 1 ; } return /^\d*[13579]$/ . test ( data ) ; } ;