MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / pickHotmailAccountForRun

Function pickHotmailAccountForRun

hotmail-utils.js:115–134  ·  view source on GitHub ↗
(accounts, options = {})

Source from the content-addressed store, hash-verified

113 }
114
115 function pickHotmailAccountForRun(accounts, options = {}) {
116 const candidates = Array.isArray(accounts) ? accounts.filter(isAuthorizedHotmailAccount) : [];
117 if (!candidates.length) return null;
118
119 const excludeIds = new Set((options.excludeIds || []).filter(Boolean));
120 const filtered = candidates.filter((account) => !excludeIds.has(account.id));
121 const pool = filtered.length ? filtered : candidates;
122
123 return pool
124 .slice()
125 .sort((left, right) => {
126 const leftUsedAt = normalizeTimestamp(left.lastUsedAt);
127 const rightUsedAt = normalizeTimestamp(right.lastUsedAt);
128 if (leftUsedAt !== rightUsedAt) {
129 return leftUsedAt - rightUsedAt;
130 }
131
132 return String(left.email || '').localeCompare(String(right.email || ''));
133 })[0] || null;
134 }
135
136 function messageMatchesFilters(message, filters = {}) {
137 const senderFilters = (filters.senderFilters || []).map(normalizeText).filter(Boolean);

Callers 2

Calls 1

normalizeTimestampFunction · 0.70

Tested by

no test coverage detected