mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 12:11:20 +00:00
refactor: dedupe channel trimmed readers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { type NodeMatchCandidate, resolveNodeIdFromCandidates } from "./node-match.js";
|
||||
import { normalizeOptionalString } from "./string-coerce.js";
|
||||
|
||||
type ResolveNodeFromListOptions<TNode extends NodeMatchCandidate> = {
|
||||
allowDefault?: boolean;
|
||||
@@ -10,7 +11,7 @@ export function resolveNodeIdFromNodeList<TNode extends NodeMatchCandidate>(
|
||||
query?: string,
|
||||
options: ResolveNodeFromListOptions<TNode> = {},
|
||||
): string {
|
||||
const q = String(query ?? "").trim();
|
||||
const q = normalizeOptionalString(query) ?? "";
|
||||
if (!q) {
|
||||
if (options.allowDefault === true && options.pickDefaultNode) {
|
||||
const picked = options.pickDefaultNode(nodes);
|
||||
|
||||
Reference in New Issue
Block a user