@fewer/validations
Version:
A collection of pipes that handle common model validation use-cases for Fewer
20 lines • 577 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function withPresence(...fieldNames) {
return {
validate(obj) {
const errors = [];
fieldNames.forEach(fieldName => {
if (!obj[fieldName]) {
errors.push({
on: fieldName,
message: 'field is not present',
});
}
});
return errors;
},
};
}
exports.withPresence = withPresence;
//# sourceMappingURL=presence.js.map