refactor: dedupe record guards

This commit is contained in:
Peter Steinberger
2026-04-07 04:21:14 +01:00
parent 59eb291c6e
commit b7be963501
6 changed files with 16 additions and 26 deletions

View File

@@ -1,3 +1,5 @@
import { isRecord } from "../../../src/utils.js";
export type JsonObject = Record<string, unknown>;
export type ExternalPluginCompatibility = {
@@ -22,10 +24,6 @@ export const EXTERNAL_CODE_PLUGIN_REQUIRED_FIELD_PATHS = [
"openclaw.build.openclawVersion",
] as const;
function isRecord(value: unknown): value is JsonObject {
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
}
function getTrimmedString(value: unknown): string | undefined {
return typeof value === "string" && value.trim() ? value.trim() : undefined;
}