Skip to content

Commit 957d2e6

Browse files
mantonimroderick
andcommittedApr 21, 2021
Avoid else by returning early
Co-authored-by: Morgan Roderick <20321+mroderick@users.noreply.github.com>
1 parent 4de3f74 commit 957d2e6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed
 

‎lib/runner.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ process.on('message', (m) => {
3333
process.send({ id: m.id, err, res, mem });
3434
}
3535

36-
if (lambda_module.handle.length < 3) {
37-
lambda_module
38-
.handle(m.event, context)
39-
.then((data) => {
40-
handleResponse(null, data);
41-
})
42-
.catch(handleResponse);
43-
} else {
36+
if (lambda_module.handle.length === 3) {
4437
lambda_module.handle(m.event, context, handleResponse);
38+
return;
4539
}
40+
41+
lambda_module
42+
.handle(m.event, context)
43+
.then((data) => {
44+
handleResponse(null, data);
45+
})
46+
.catch(handleResponse);
4647
});

0 commit comments

Comments
 (0)