-
Notifications
You must be signed in to change notification settings - Fork 268
Open
Description
Hi,
While using this repository as an example to build my app, I saw an opportunity to contribute cleaning the code.
Default parameters are often cleaner than shorting circuiting (or thernary operator, in this case).
Be aware that if you use default parameters, your function will only provide default values for undefined arguments. Other "falsy" values such as '', "", false, null, 0, and NaN, will not be replaced by a default value.
So, if this is a problem in this case, please, let me know.
Bad:
white-label/src/core/infra/BaseController.ts
Lines 34 to 36 in 503ee49
| public clientError (message?: string) { | |
| return BaseController.jsonResponse(this.res, 400, message ? message : 'Unauthorized'); | |
| } |
Good:
public clientError (message = 'Unauthorized') {
return BaseController.jsonResponse(this.res, 400, message);
}Metadata
Metadata
Assignees
Labels
No labels