@contrast/route-coverage 1.20.3 → 1.20.4
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.
- package/lib/install/express.js +3 -7
- package/package.json +1 -1
package/lib/install/express.js
CHANGED
|
@@ -102,17 +102,13 @@ module.exports = function init(core) {
|
|
|
102
102
|
post({ args, result }) {
|
|
103
103
|
const len = args.length;
|
|
104
104
|
const fn = args[len - 1];
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (len > 1) {
|
|
108
|
-
path = args[0];
|
|
109
|
-
if (!isValidPath(path)) return;
|
|
110
|
-
}
|
|
105
|
+
const path = len > 1 ? args[0] : undefined;
|
|
106
|
+
if (path && !isValidPath(path)) return;
|
|
111
107
|
const handlers = Array.isArray(fn) ? fn : [fn];
|
|
112
108
|
handlers.forEach((layer) => {
|
|
113
109
|
if (isRouter(layer)) {
|
|
114
110
|
traverse(path, layer.stack);
|
|
115
|
-
} else {
|
|
111
|
+
} else if (path) {
|
|
116
112
|
const routeInfo = createRouteInfo(format(path), 'use', 'App');
|
|
117
113
|
discover(routeInfo);
|
|
118
114
|
const lastLayer = getLastLayer(result._router);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/route-coverage",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.4",
|
|
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)",
|