mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-25 16:12:13 +00:00
refactor: dedupe reader helpers
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { normalizeTrimmedStringList } from "openclaw/plugin-sdk/text-runtime";
|
||||
import { normalizeOptionalTrimmedStringList } from "openclaw/plugin-sdk/text-runtime";
|
||||
import {
|
||||
type BrowserConfig,
|
||||
type BrowserProfileConfig,
|
||||
@@ -113,13 +113,7 @@ function resolveCdpPortRangeStart(
|
||||
return start;
|
||||
}
|
||||
|
||||
function normalizeStringList(raw: string[] | undefined): string[] | undefined {
|
||||
if (!Array.isArray(raw) || raw.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const values = normalizeTrimmedStringList(raw);
|
||||
return values.length > 0 ? values : undefined;
|
||||
}
|
||||
const normalizeStringList = normalizeOptionalTrimmedStringList;
|
||||
|
||||
function resolveBrowserSsrFPolicy(cfg: BrowserConfig | undefined): SsrFPolicy | undefined {
|
||||
const rawPolicy = cfg?.ssrfPolicy as
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import type * as Lark from "@larksuiteoapi/node-sdk";
|
||||
import { readStringValue } from "openclaw/plugin-sdk/text-runtime";
|
||||
import { cleanBlocksForDescendant } from "./docx-table-ops.js";
|
||||
import type { FeishuDocxBlock, FeishuDocxBlockChild } from "./docx-types.js";
|
||||
|
||||
@@ -25,7 +26,8 @@ function normalizeChildIds(children: string[] | string | undefined): string[] |
|
||||
if (Array.isArray(children)) {
|
||||
return children;
|
||||
}
|
||||
return typeof children === "string" ? [children] : undefined;
|
||||
const child = readStringValue(children);
|
||||
return child ? [child] : undefined;
|
||||
}
|
||||
|
||||
function toDescendantBlock(block: FeishuDocxBlock): DocxDescendantCreateBlock {
|
||||
|
||||
Reference in New Issue
Block a user