class ValidationUtil { static hasText ( value , valueName ) { if ( value == null || value == undefined || value . trim ( ) == "" ) throw new Error ( "'" + valueName + "'" + " can't be null or white space" ) ; } public static hasTextWithMaxLength ( value , length , valueName ) { ValidationUtil . hasText ( value , valueName ) ; if ( value . length > length ) throw new Error ( "'" + valueName + "'" + " is too long, the maximum length is " + length ) ; } public static hasTextTrimWithMaxLength ( value , length , valueName ) { ValidationUtil . hasText ( value , valueName ) ; if ( value . length > value . trim ( ) . length ) throw new Error ( "'" + valueName + "'" + " has spaces at the beginning or the end" ) ; if ( value . length > length ) throw new Error ( "'" + valueName + "'" + " is too long, the maximum length is " + length ) ; } public static hasElements ( value , valueName ) { if ( value == null || value . length == 0 ) throw new Error ( "list '" + valueName + "'" + " can't be null or empty" ) ; } } export default ValidationUtil ;