Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/plugin-code-editor/src/utils/schema-to-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ function createFunctionCode(functionName: string, functionNode: Method) {
functionCode = functionCode.replace(/function/, '');
} else {
// 兼容历史数据
functionCode = functionNode.value?.replace(/function/, functionName);
// 如果函数名称已经包含在函数定义中,需要移除重复的函数名
if (functionNode.value?.includes(`function ${functionName}`)) {
functionCode = functionNode.value?.replace(`function ${functionName}`, functionName);
} else {
functionCode = functionNode.value?.replace(/function/, functionName);
}
}
return functionCode;
}
Expand Down