diff --git a/dist/router.js b/dist/router.js index 7ea3172..94652ce 100644 --- a/dist/router.js +++ b/dist/router.js @@ -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(); } diff --git a/src/router.ts b/src/router.ts index af92eb5..c54e199 100644 --- a/src/router.ts +++ b/src/router.ts @@ -95,6 +95,8 @@ export default class Router { */ use(obj: Router | Tpl): void { 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(); }