Takes two validators, the validator and the validator, then returns a new function receiving a value (of any type) and execute the validator only when the returns true.
It is largely used within the library itself to evaluate certain conditions:
/* Part of the contains validator */constcontains= (value) =>compose(when(isString, (string) =>string.includes(value)),when(Array.isArray,arrayContains(value)),when(not(or(isString,Array.isArray)), stubFalse),);