@contrast/route-coverage 1.20.2 → 1.20.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.
@@ -74,7 +74,7 @@ module.exports = function init(core) {
74
74
  });
75
75
  }
76
76
 
77
- function traverse(path, stack, depth = 0) {
77
+ function traverse(path = '', stack, depth = 0) {
78
78
  path = format(path);
79
79
  stack.forEach((layer) => {
80
80
  if (isRoute(layer)) {
@@ -102,8 +102,12 @@ module.exports = function init(core) {
102
102
  post({ args, result }) {
103
103
  const len = args.length;
104
104
  const fn = args[len - 1];
105
- const path = len > 1 ? args[0] : '';
106
- if (!isValidPath(path)) return;
105
+
106
+ let path;
107
+ if (len > 1) {
108
+ path = args[0];
109
+ if (!isValidPath(path)) return;
110
+ }
107
111
  const handlers = Array.isArray(fn) ? fn : [fn];
108
112
  handlers.forEach((layer) => {
109
113
  if (isRouter(layer)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/route-coverage",
3
- "version": "1.20.2",
3
+ "version": "1.20.3",
4
4
  "description": "Handles route discovery and observation",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",