validate that routes are an array before merging with another Router instance
This commit is contained in:
1 parent
c6f87538f6
commit
b72ed99fb8
2 files changed
+4
No files matched your search
Vendored
+2
@@ -70,6 +70,8 @@ export default class Router {
|
||||
}
|
||||
use(obj) {
|
||||
if (obj instanceof Router) {
|
||||
if (!Array.isArray(obj.routes))
|
||||
throw new TypeError("Routes must be an array.");
|
||||
this.routes = [...this.routes, ...obj.routes];
|
||||
this.sortRoutes();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user