refactor: dedupe trimmed string readers

This commit is contained in:
Peter Steinberger
2026-04-07 04:26:13 +01:00
parent b7be963501
commit d03985415d
13 changed files with 46 additions and 67 deletions

View File

@@ -1,3 +1,4 @@
import { normalizeOptionalString } from "../../../src/shared/string-coerce.js";
import { isRecord } from "../../../src/utils.js";
export type JsonObject = Record<string, unknown>;
@@ -25,7 +26,7 @@ export const EXTERNAL_CODE_PLUGIN_REQUIRED_FIELD_PATHS = [
] as const;
function getTrimmedString(value: unknown): string | undefined {
return typeof value === "string" && value.trim() ? value.trim() : undefined;
return normalizeOptionalString(value);
}
function readOpenClawBlock(packageJson: unknown) {