refactor: dedupe feishu security record helper

This commit is contained in:
Peter Steinberger
2026-04-06 22:37:27 +01:00
parent 0cc4f50576
commit 9bee2a4ede
2 changed files with 8 additions and 7 deletions

View File

@@ -18,6 +18,13 @@ export function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null;
}
export function asRecord(value: unknown): Record<string, unknown> | undefined {
if (!value || typeof value !== "object" || Array.isArray(value)) {
return undefined;
}
return value as Record<string, unknown>;
}
export function extractCommentElementText(element: unknown): string | undefined {
if (!isRecord(element)) {
return undefined;

View File

@@ -1,12 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/setup";
function asRecord(value: unknown): Record<string, unknown> | undefined {
if (!value || typeof value !== "object" || Array.isArray(value)) {
return undefined;
}
return value as Record<string, unknown>;
}
import { asRecord } from "./comment-shared.js";
function hasNonEmptyString(value: unknown): boolean {
return typeof value === "string" && value.trim().length > 0;