No, there are no issues, but you can argue about the readability.
if(foo) {
// do something
} else {
// do something else
}
Is not much less readable than
if(foo) {
// do something
return;
}
// do something else
Although I personally think the first version is a better representation of the logic sequence and the only way to run code after the first and second alternative, this does not apply to your case.
It is fine to abbreviate the flow as you did. When using JavaScript, I make it even shorter:
if(err) return next(err, null);
As most callbacks should ignore data parameters if the err
parameter is set, the following should be enough:
if(err) return next(err);
This is the shortest possible form and I'd prefer it over every if-else statement.