Skip to content

Commit 6a02b2b

Browse files
committed
refactor(golang): extract variables
1 parent ff420ee commit 6a02b2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cli.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ const createEndpoints = async (destDir, lang, config) => {
162162
}
163163
return Array.from(
164164
new Set(params),
165-
p => `"${p.substring(2)}": ${placeholdersMap['go'][p.substring(0, 1)]}.${capitalize(snake2camelCase(p.substring(2)))},`
165+
p => {
166+
const bindTarget = p.substring(0, 1);
167+
const paramName = p.substring(2);
168+
const fieldName = capitalize(snake2camelCase(paramName));
169+
return `"${paramName}": ${placeholdersMap['go'][bindTarget]}.${fieldName},`
170+
}
166171
).join('\n\t\t\t');
167172
},
168173
}

0 commit comments

Comments
 (0)