Skip to content

Instantly share code, notes, and snippets.

View Emilios1995's full-sized avatar

Emilio Srougo Emilios1995

View GitHub Profile
const normalize = (spec, input) =>
Object.keys(spec).reduce(
(acc, x) => R.assoc(x, R.propOr(null, x, input), acc),
{}
);
const normalize = (spec, input) =>
Object.keys(spec).reduce(
(acc, x) => R.assoc(x, R.propOr(null, x, input), acc),
{}
);
const optionalTypeRule = type => [
unlessNil(isType(type)),
(val, field) => `if ${field} is set, it must be a ${type}`
];
const validationRules = {
appDescription: [optionalTypeRule('String')]
}
const validationRules = {
notificationsClientId: [
[
dep("getsNotifications", R.equals(true), isType("String")),
"If getsNotifications is true, notificationsClientId is required as a string"
]
]
}