@middy/do-not-wait-for-empty-event-loop 3.0.0-alpha.2 → 3.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -15
  2. package/package.json +5 -4
package/index.js CHANGED
@@ -1,22 +1,21 @@
1
+
2
+ const defaults = {
3
+ runOnBefore: true,
4
+ runOnAfter: false,
5
+ runOnError: false
6
+ }
7
+
1
8
  const doNotWaitForEmptyEventLoopMiddleware = (opts = {}) => {
2
- const defaults = {
3
- runOnBefore: true,
4
- runOnAfter: false,
5
- runOnError: false
6
- };
7
- const options = { ...defaults,
8
- ...opts
9
- };
9
+ const options = { ...defaults, ...opts }
10
10
 
11
- const doNotWaitForEmptyEventLoop = async request => {
12
- request.context.callbackWaitsForEmptyEventLoop = false;
13
- };
11
+ const doNotWaitForEmptyEventLoop = async (request) => {
12
+ request.context.callbackWaitsForEmptyEventLoop = false
13
+ }
14
14
 
15
15
  return {
16
16
  before: options.runOnBefore ? doNotWaitForEmptyEventLoop : undefined,
17
17
  after: options.runOnAfter ? doNotWaitForEmptyEventLoop : undefined,
18
18
  onError: options.runOnError ? doNotWaitForEmptyEventLoop : undefined
19
- };
20
- };
21
-
22
- export default doNotWaitForEmptyEventLoopMiddleware;
19
+ }
20
+ }
21
+ export default doNotWaitForEmptyEventLoopMiddleware
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/do-not-wait-for-empty-event-loop",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.3",
4
4
  "description": "Middleware for the middy framework that allows to easily disable the wait for empty event loop in a Lambda function",
5
5
  "type": "module",
6
6
  "engines": {
@@ -18,7 +18,8 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "test": "npm run test:unit",
21
- "test:unit": "ava"
21
+ "test:unit": "ava",
22
+ "test:benchmark": "node __benchmarks__/index.js"
22
23
  },
23
24
  "license": "MIT",
24
25
  "keywords": [
@@ -44,9 +45,9 @@
44
45
  "url": "https://github.com/middyjs/middy/issues"
45
46
  },
46
47
  "homepage": "https://github.com/middyjs/middy#readme",
47
- "gitHead": "de30419273ecbff08f367f47c7e320ec981cf145",
48
+ "gitHead": "1441158711580313765e6d156046ef0fade0d156",
48
49
  "devDependencies": {
49
- "@middy/core": "^3.0.0-alpha.2",
50
+ "@middy/core": "^3.0.0-alpha.3",
50
51
  "@types/aws-lambda": "^8.10.76"
51
52
  }
52
53
  }