mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-15 19:21:08 +00:00
refactor: dedupe record guards
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user