Skip to content

reduce if/else #173

@cubap

Description

@cubap

return instead of else. As an example:

if (rest.checkPatchOverrideSupport(req, res)) {
controller.patchSet(req, res, next)
}
else {
res.statusMessage = 'Improper request method for updating, please use PATCH to add new keys to this object.'
res.status(405)
next()
}

prefer the use of guard clauses where efficient and clear. Only assign results to a variable if they are needed later.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions