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,7 +1,9 @@
import {
asOptionalRecord,
hasNonEmptyString as sharedHasNonEmptyString,
isRecord as sharedIsRecord,
normalizeOptionalString,
readStringValue,
} from "openclaw/plugin-sdk/text-runtime";
export function encodeQuery(params: Record<string, string | undefined>): string {
@@ -16,15 +18,11 @@ export function encodeQuery(params: Record<string, string | undefined>): string
return queryString ? `?${queryString}` : "";
}
export function readString(value: unknown): string | undefined {
return typeof value === "string" ? value : undefined;
}
export const readString = readStringValue;
export const normalizeString = normalizeOptionalString;
export function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null;
}
export const isRecord = sharedIsRecord;
export const asRecord = asOptionalRecord;