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

Function normalizeMessage

microsoft-email.js:157–176  ·  view source on GitHub ↗
(message, mailbox = 'INBOX')

Source from the content-addressed store, hash-verified

155 }
156
157 function normalizeMessage(message, mailbox = 'INBOX') {
158 const sender = message?.From || message?.from || {};
159 const emailAddress = sender?.EmailAddress || sender?.emailAddress || {};
160 return {
161 mailbox: normalizeMailboxLabel(mailbox || message?.mailbox),
162 from: {
163 emailAddress: {
164 address: String(emailAddress?.Address || emailAddress?.address || '').trim(),
165 name: String(emailAddress?.Name || emailAddress?.name || '').trim(),
166 },
167 },
168 subject: String(message?.Subject || message?.subject || '').trim(),
169 receivedDateTime: String(message?.ReceivedDateTime || message?.receivedDateTime || '').trim(),
170 bodyPreview: String(message?.BodyPreview || message?.bodyPreview || '').trim(),
171 body: {
172 content: String(message?.Body?.Content || message?.body?.content || '').trim(),
173 },
174 id: String(message?.Id || message?.id || message?.internetMessageId || '').trim(),
175 };
176 }
177
178 function normalizeFilterValue(value) {
179 return String(value || '').trim().toLowerCase();

Calls 1

normalizeMailboxLabelFunction · 0.85

Tested by

no test coverage detected