test: simplify ios team candidate parsing · openclaw/openclaw@e305c7a
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -24,18 +24,27 @@ type TeamCandidate = {
|
24 | 24 | }; |
25 | 25 | |
26 | 26 | function parseTeamCandidateRows(raw: string): TeamCandidate[] { |
27 | | -return raw |
28 | | -.split("\n") |
29 | | -.map((line) => line.replace(/\r/g, "").trim()) |
30 | | -.filter(Boolean) |
31 | | -.map((line) => line.split("\t")) |
32 | | -.filter((parts) => parts.length >= 3) |
33 | | -.map((parts) => ({ |
34 | | -teamId: parts[0] ?? "", |
| 27 | +const candidates: TeamCandidate[] = []; |
| 28 | +for (const rawLine of raw.split("\n")) { |
| 29 | +const line = rawLine.replace(/\r/g, "").trim(); |
| 30 | +if (!line) { |
| 31 | +continue; |
| 32 | +} |
| 33 | +const parts = line.split("\t"); |
| 34 | +if (parts.length < 3) { |
| 35 | +continue; |
| 36 | +} |
| 37 | +const teamId = parts[0] ?? ""; |
| 38 | +if (!teamId) { |
| 39 | +continue; |
| 40 | +} |
| 41 | +candidates.push({ |
| 42 | + teamId, |
35 | 43 | isFree: (parts[1] ?? "0") === "1", |
36 | 44 | teamName: parts[2] ?? "", |
37 | | -})) |
38 | | -.filter((candidate) => candidate.teamId.length > 0); |
| 45 | +}); |
| 46 | +} |
| 47 | +return candidates; |
39 | 48 | } |
40 | 49 | |
41 | 50 | function pickTeamIdFromCandidates(params: { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。