Skip to content

Commit

Permalink
fix(examples): improve readability of user assignment (#6190)
Browse files Browse the repository at this point in the history
Edit assignment inside condition check to a separate step
  • Loading branch information
sazk07 authored Dec 17, 2024
1 parent 1faf228 commit 2041584
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/params/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ app.param(['to', 'from'], function(req, res, next, num, name){
// Load user by id

app.param('user', function(req, res, next, id){
if (req.user = users[id]) {
req.user = users[id];
if (req.user) {
next();
} else {
next(createError(404, 'failed to find user'));
Expand Down

0 comments on commit 2041584

Please sign in to comment.