mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 16:00:24 +00:00
refactor: dedupe lowercase helper readers
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { normalizeOptionalString } from "./string-coerce.js";
|
||||
import { normalizeOptionalLowercaseString, normalizeOptionalString } from "./string-coerce.js";
|
||||
|
||||
export type NodeMatchCandidate = {
|
||||
nodeId: string;
|
||||
@@ -40,12 +40,12 @@ function formatNodeCandidateLabel(node: NodeMatchCandidate): string {
|
||||
}
|
||||
|
||||
function isCurrentOpenClawClient(clientId: string | undefined): boolean {
|
||||
const normalized = normalizeOptionalString(clientId)?.toLowerCase() ?? "";
|
||||
const normalized = normalizeOptionalLowercaseString(clientId) ?? "";
|
||||
return normalized.startsWith("openclaw-");
|
||||
}
|
||||
|
||||
function isLegacyClawdbotClient(clientId: string | undefined): boolean {
|
||||
const normalized = normalizeOptionalString(clientId)?.toLowerCase() ?? "";
|
||||
const normalized = normalizeOptionalLowercaseString(clientId) ?? "";
|
||||
return normalized.startsWith("clawdbot-") || normalized.startsWith("moldbot-");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { normalizeOptionalString } from "./string-coerce.js";
|
||||
import { normalizeOptionalLowercaseString, normalizeOptionalString } from "./string-coerce.js";
|
||||
|
||||
export function normalizeStringEntries(list?: ReadonlyArray<unknown>) {
|
||||
return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean);
|
||||
@@ -52,7 +52,7 @@ export function normalizeCsvOrLooseStringList(value: unknown): string[] {
|
||||
}
|
||||
|
||||
export function normalizeHyphenSlug(raw?: string | null) {
|
||||
const trimmed = normalizeOptionalString(raw)?.toLowerCase() ?? "";
|
||||
const trimmed = normalizeOptionalLowercaseString(raw) ?? "";
|
||||
if (!trimmed) {
|
||||
return "";
|
||||
}
|
||||
@@ -62,7 +62,7 @@ export function normalizeHyphenSlug(raw?: string | null) {
|
||||
}
|
||||
|
||||
export function normalizeAtHashSlug(raw?: string | null) {
|
||||
const trimmed = normalizeOptionalString(raw)?.toLowerCase() ?? "";
|
||||
const trimmed = normalizeOptionalLowercaseString(raw) ?? "";
|
||||
if (!trimmed) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user