export function required(errorMessage) {
    return (value) => {
        if (!value || value.length < 1) {
            return errorMessage;
        }
        return true;
    };
}

export function regex(expression, errorMessage) {
    return (value) => {
        // Field is empty, should pass
        if (!value || !value.length) {
            return true;
        }

        // Check if email
        if (!expression.test(value)) {
            return errorMessage;
        }

        return true;
    };
}
