@zenofolio/hyper-decor 1.0.45 → 1.0.46

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.
@@ -5,14 +5,15 @@ const tsyringe_1 = require("tsyringe");
5
5
  function middlewareTransformer(list) {
6
6
  return list
7
7
  .map((middleware) => {
8
+ if (isClass(middleware)) {
9
+ const instance = tsyringe_1.container.resolve(middleware);
10
+ return instance.handle.bind(instance);
11
+ }
8
12
  if (typeof middleware === "function") {
9
- if (middleware.constructor) {
10
- const instance = tsyringe_1.container.resolve(middleware);
11
- return instance.handle.bind(instance);
12
- }
13
13
  return middleware;
14
14
  }
15
15
  return null;
16
16
  })
17
- .filter((middleware) => middleware);
17
+ .filter((middleware) => !!middleware);
18
18
  }
19
+ const isClass = (fn) => typeof fn === "function" && `${fn}`.indexOf("class") === 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenofolio/hyper-decor",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "Project core with utilities and features",
5
5
  "main": "dist/index.js",
6
6
  "author": "zenozaga",