From 52d95b8ba902b21ac9a9d57bfc39a94a336bdccc Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Thu, 26 Sep 2024 18:00:56 +0200 Subject: [PATCH] Reorg function order --- src/lib/code-sample/go.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/lib/code-sample/go.ts b/src/lib/code-sample/go.ts index 2f47471..8a0cc02 100644 --- a/src/lib/code-sample/go.ts +++ b/src/lib/code-sample/go.ts @@ -133,21 +133,6 @@ const formatGoArray = (value: Json[], key: string): string => { return `[${value.length}]${arrayType}{${formattedItems.join(', ')}}` } -const formatGoObject = (value: Record, key: string): string => { - if (Object.keys(value).length === 0) { - return 'struct{}{}' - } - - const formattedEntries = Object.entries(value) - .map( - ([objKey, val]) => - `${pascalCase(objKey)}: ${formatGoValue({ value: val, key: objKey })}`, - ) - .join(', ') - - return `api.${pascalCase(key)}{${formattedEntries}}` -} - const isPrimitiveValue = (value: Json): boolean => value != null && typeof value !== 'object' @@ -164,4 +149,19 @@ const getPrimitiveTypeName = (value: Json): string => { } } +const formatGoObject = (value: Record, key: string): string => { + if (Object.keys(value).length === 0) { + return 'struct{}{}' + } + + const formattedEntries = Object.entries(value) + .map( + ([objKey, val]) => + `${pascalCase(objKey)}: ${formatGoValue({ value: val, key: objKey })}`, + ) + .join(', ') + + return `api.${pascalCase(key)}{${formattedEntries}}` +} + export const createGoResponse = createJsonResponse