MCPcopy Index your code
hub / github.com/CopyTranslator/CopyTranslator / googleCheck

Function googleCheck

src/common/configuration.ts:69–93  ·  view source on GitHub ↗
(value: KeyConfig)

Source from the content-addressed store, hash-verified

67}
68
69function googleCheck(value: KeyConfig): CheckResult {
70 const invalidKeys = getInvalidStringKeys(value);
71 if (invalidKeys.length > 0) {
72 const reason = `字段类型无效: ${invalidKeys.join(", ")}`;
73 return { canSave: false, canEnable: false, saveReason: reason, enableReason: reason };
74 }
75 const source = value.source;
76 if (is_empty_string(source)) {
77 return {
78 canSave: false,
79 canEnable: false,
80 saveReason: "翻译源不能为空",
81 enableReason: "翻译源不能为空",
82 };
83 }
84 if (!googleSourceOptions.includes(source as GoogleSource)) {
85 return {
86 canSave: false,
87 canEnable: false,
88 saveReason: "翻译源无效",
89 enableReason: "翻译源无效",
90 };
91 }
92 return { canSave: true, canEnable: true };
93}
94
95// 检查是否全空或全填写
96function emptyOrAllCheck(value: KeyConfig): CheckResult {

Callers

nothing calls this directly

Calls 2

getInvalidStringKeysFunction · 0.85
is_empty_stringFunction · 0.85

Tested by

no test coverage detected