@middy/util 6.3.1 → 6.4.0

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 (3) hide show
  1. package/index.d.ts +0 -4
  2. package/index.js +7 -7
  3. package/package.json +7 -3
package/index.d.ts CHANGED
@@ -42,10 +42,6 @@ declare function canPrefetch<Client, ClientOptions>(
42
42
  options: Options<Client, ClientOptions>,
43
43
  ): boolean;
44
44
 
45
- type InternalOutput<TVariables> = TVariables extends string[]
46
- ? { [key in TVariables[number]]: unknown }
47
- : never;
48
-
49
45
  // get an empty object if false is passed
50
46
  declare function getInternal<
51
47
  TContext extends LambdaContext,
package/index.js CHANGED
@@ -85,11 +85,11 @@ export const getInternal = async (variables, request) => {
85
85
  cause: { package: "@middy/util", data: errors },
86
86
  });
87
87
  }
88
- return keys.reduce(
89
- (obj, key, index) =>
90
- Object.assign(obj, { [sanitizeKey(key)]: values[index].value }),
91
- {},
92
- );
88
+ const obj = {};
89
+ for (let i = keys.length; i--; ) {
90
+ obj[sanitizeKey(keys[i])] = values[i].value;
91
+ }
92
+ return obj;
93
93
  };
94
94
 
95
95
  const isPromise = (promise) => typeof promise?.then === "function";
@@ -180,7 +180,7 @@ export const jsonSafeParse = (text, reviver) => {
180
180
  if (firstChar !== "{" && firstChar !== "[" && firstChar !== '"') return text;
181
181
  try {
182
182
  return JSON.parse(text, reviver);
183
- } catch (e) {}
183
+ } catch (_e) {}
184
184
 
185
185
  return text;
186
186
  };
@@ -188,7 +188,7 @@ export const jsonSafeParse = (text, reviver) => {
188
188
  export const jsonSafeStringify = (value, replacer, space) => {
189
189
  try {
190
190
  return JSON.stringify(value, replacer, space);
191
- } catch (e) {}
191
+ } catch (_e) {}
192
192
 
193
193
  return value;
194
194
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/util",
3
- "version": "6.3.1",
3
+ "version": "6.4.0",
4
4
  "description": "🛵 The stylish Node.js middleware engine for AWS Lambda (util package)",
5
5
  "type": "module",
6
6
  "engines": {
@@ -23,7 +23,11 @@
23
23
  }
24
24
  },
25
25
  "types": "index.d.ts",
26
- "files": ["index.js", "index.d.ts", "type-utils.d.ts"],
26
+ "files": [
27
+ "index.js",
28
+ "index.d.ts",
29
+ "type-utils.d.ts"
30
+ ],
27
31
  "scripts": {
28
32
  "test": "npm run test:unit && npm run test:fuzz",
29
33
  "test:unit": "node --test",
@@ -55,7 +59,7 @@
55
59
  },
56
60
  "devDependencies": {
57
61
  "@aws-sdk/client-ssm": "^3.0.0",
58
- "@middy/core": "6.3.1",
62
+ "@middy/core": "6.4.0",
59
63
  "@types/aws-lambda": "^8.10.76",
60
64
  "@types/node": "^20.0.0",
61
65
  "aws-xray-sdk": "^3.3.3"