const isStringOrNull = either(isString, isNull);
isStringOrNull("") >>
{
valid: true,
parsed: "",
};
isStringOrNull(null) >>
{
valid: true,
parsed: null,
};
isStringOrNull(1) >>
{
valid: false,
error: "Not a string: 1",
};
Combine two validators with a logical OR