mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 17:10:23 +00:00
refactor: dedupe plugin string list helpers
This commit is contained in:
@@ -13,6 +13,16 @@ export function trimBundledPluginString(value: unknown): string | undefined {
|
||||
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
||||
}
|
||||
|
||||
export function normalizeBundledPluginStringList(value: unknown): string[] {
|
||||
if (!Array.isArray(value)) {
|
||||
return [];
|
||||
}
|
||||
return value.flatMap((entry) => {
|
||||
const normalized = trimBundledPluginString(entry);
|
||||
return normalized ? [normalized] : [];
|
||||
});
|
||||
}
|
||||
|
||||
export function rewriteBundledPluginEntryToBuiltPath(
|
||||
entry: string | undefined,
|
||||
): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user