Files
openclaw/extensions/browser/src/record-shared.ts
2026-06-04 08:00:12 -04:00

27 lines
819 B
TypeScript

/**
* Small record/string coercion helpers shared by Browser setup and audits.
*/
import {
asNullableRecord,
hasNonEmptyString as sharedHasNonEmptyString,
isRecord,
} from "openclaw/plugin-sdk/string-coerce-runtime";
/** Re-export record guards under Browser-local names. */
export { asNullableRecord as asRecord, isRecord };
/** Re-export shared non-empty string predicate. */
export const hasNonEmptyString = sharedHasNonEmptyString;
/** Normalizes primitive string/number/boolean values to non-empty strings. */
export function normalizeString(value: unknown): string | undefined {
if (typeof value === "string") {
const trimmed = value.trim();
return trimmed || undefined;
}
if (typeof value === "number" || typeof value === "boolean") {
return String(value);
}
return undefined;
}