import { ElemValueType } from '../modules/interfaces' ; const EMAIL_REGEXP = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ ; const NUMBER_REGEXP = /^[0-9]+$/ ; const PASSWORD_REGEXP = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/ ; const STRONG_PASSWORD_REGEXP = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/ ; export const isEmpty = ( value ) : boolean => { let newVal = value ; if ( typeof value === 'string' ) { newVal = value . trim ( ) ; } return ! newVal ; } ; export const isEmail = ( value ) : boolean => { return EMAIL_REGEXP . test ( value ) ; } ; export const isLengthMoreThanMax = ( value , len ) : boolean => { return value . length > len ; } ; export const isLengthLessThanMin = ( value , len ) : boolean => { return value . length < len ; } ; export const isNumber = ( value ) : boolean => { return NUMBER_REGEXP . test ( value ) ; } ; export const isPassword = ( value ) : boolean => { return PASSWORD_REGEXP . test ( value ) ; } ; export const isStrongPassword = ( value ) : boolean => { return STRONG_PASSWORD_REGEXP . test ( value ) ; } ; export const isNumberMoreThanMax = ( value , len ) : boolean => { return value > len ; } ; export const isNumberLessThanMin = ( value , len ) : boolean => { return value < len ; } ;