mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-17 03:02:14 +00:00
refactor: dedupe feishu security record helper
This commit is contained in:
parent
0cc4f50576
commit
9bee2a4ede
2 changed files with 8 additions and 7 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue