Skip to content

Commit 00592a0

Browse files
authored
Refactor: improve readability
Edit assignment inside condition check to a separate step
1 parent 59fc270 commit 00592a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/params/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ app.param(['to', 'from'], function(req, res, next, num, name){
3232
// Load user by id
3333

3434
app.param('user', function(req, res, next, id){
35-
if (req.user = users[id]) {
35+
req.user = users[id];
36+
if (req.user) {
3637
next();
3738
} else {
3839
next(createError(404, 'failed to find user'));

0 commit comments

Comments
 (0)