From 810fa8f1e8f6d8ee67b4a8ec5d977bc24db1070e Mon Sep 17 00:00:00 2001 From: opl <4833621+opl@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:23:24 +0200 Subject: [PATCH] Include parameter names when stringifying RouterNodeData --- lib/Router.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/Router.ts b/lib/Router.ts index edffe23..066765f 100644 --- a/lib/Router.ts +++ b/lib/Router.ts @@ -59,16 +59,19 @@ export class RouterNodeData { } toString(): string { - return `methods (${this.methodData.size}): ${[...this.methodData.entries()].map(([method, data]) => [ - '\x1b[1m', // bold - method, - '\x1b[22m {', // normal intensity - [ - data.middleware.length === 0 ? null : `middleware=${data.middleware.length}`, - data.terminators.length === 0 ? null : `terminators=${data.terminators.length}`, - ].filter((v) => v).join(', '), - '}' - ].join('')).join(', ')}`; + return [ + this.methodData.size === 0 ? null : `methods (${this.methodData.size}): ${[...this.methodData.entries()].map(([method, data]) => [ + '\x1b[1m', // bold + method, + '\x1b[22m {', // normal intensity + [ + data.middleware.length === 0 ? null : `middleware=${data.middleware.length}`, + data.terminators.length === 0 ? null : `terminators=${data.terminators.length}`, + ].filter((v) => v).join(', '), + '}' + ].join('')).join(', ')}`, + this.lateParams.length === 0 ? null : `lateParams (${this.lateParams.length}): ${this.lateParams.orderedData.map((param) => param.name).join(', ')}` + ].filter((v) => v).join('; '); } }