From 3ec192cfe439ed2203a3f7ef1dc10be4b7f8100f Mon Sep 17 00:00:00 2001 From: John Cowen Date: Thu, 5 Dec 2024 15:29:34 +0000 Subject: [PATCH] return early Signed-off-by: John Cowen --- .../kuma-gui/src/app/application/index.ts | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/kuma-gui/src/app/application/index.ts b/packages/kuma-gui/src/app/application/index.ts index 56ce621f5..11b33cb0f 100644 --- a/packages/kuma-gui/src/app/application/index.ts +++ b/packages/kuma-gui/src/app/application/index.ts @@ -103,22 +103,23 @@ const addPath = (item: RouteRecordRaw, parent?: RouteRecordRaw) => { } } const addRouteName = (item: RouteRecordRaw) => { - if (typeof item.name !== 'undefined') { - const props = ((props) => { - switch (true) { - case typeof props === 'function': - return props - case typeof props === 'undefined': - return () => ({}) - default: - return () => props - } - })(item.props) - item.props = (...args) => { - return { - ...props(...args), - routeName: item.name, - } + if (typeof item.name === 'undefined') { + return + } + const props = ((props) => { + switch (true) { + case typeof props === 'function': + return props + case typeof props === 'undefined': + return () => ({}) + default: + return () => props + } + })(item.props) + item.props = (...args) => { + return { + ...props(...args), + routeName: item.name, } } }