Typo && Spacing

There was an extraneous space. I also updated functions syntax to follow the style guide referenced in other parts of this document. These functions could potentially be updated to es6 as well.
This commit is contained in:
Ryan Busby
2018-12-11 13:58:19 -08:00
committed by GitHub
parent bbafab92ed
commit d6d0d36203

View File

@ -17,8 +17,7 @@ var memberSchema = Joi.object().keys({
email: Joi.string().email() email: Joi.string().email()
}); });
function addNewMember(newMember) function addNewMember(newMember) {
{
// assertions come first // assertions come first
Joi.assert(newMember, memberSchema); //throws if validation fails Joi.assert(newMember, memberSchema); //throws if validation fails
// other logic here // other logic here
@ -29,11 +28,11 @@ function addNewMember(newMember)
### Anti-pattern: no validation yields nasty bugs ### Anti-pattern: no validation yields nasty bugs
```javascript ```javascript
// if the discount is positive let's then redirect the user to pring his discount coupons // if the discount is positive let's then redirect the user to print his discount coupons
function redirectToPrintDiscount(httpResponse, member, discount) function redirectToPrintDiscount(httpResponse, member, discount)
{ if (discount != 0) {
if(discount != 0)
httpResponse.redirect(`/discountPrintView/${member.id}`); httpResponse.redirect(`/discountPrintView/${member.id}`);
}
} }
redirectToPrintDiscount(httpResponse, someMember); redirectToPrintDiscount(httpResponse, someMember);