import { isEmpty , pipe , filter , isNil , gt , lt , gte , lte , find } from 'ramda' ; export const isValid = ( ... validators ) : any => ( arg ) => isNil ( find ( val => ! val ( arg ) , validators ) ) ; export const maxNumberValidation = ( max ) => ( value ) => lt ( value , max ) ; export const minNumberValidation = ( min ) => ( value ) => gt ( value , min ) ; export const maxStringLengthValidation = ( max ) => ( value ) => value ? maxNumberValidation ( max ) ( value . length ) : true ; export const minStringLengthValidation = ( min ) => ( value ) => value ? minNumberValidation ( min ) ( value . length ) : true ; export const arrayNotEmptyValidation = ( value ) => { const hasValue = pipe ( filter ( isNil ) , isEmpty ) ; return isEmpty ( value ) ? false : hasValue ( value ) ; } ; export const isBetweenNumber = ( min , max ) => ( value ) => gte ( value , min ) && lte ( value , max ) ;