(thread: SerializedThread)
| 11 | }; |
| 12 | |
| 13 | export function getImageUrls(thread: SerializedThread) { |
| 14 | const { messages } = thread; |
| 15 | |
| 16 | const array = messages.map((message) => { |
| 17 | const parser = parsers[message.messageFormat]; |
| 18 | const tree = parser(message.body); |
| 19 | const urls = find.urls(tree); |
| 20 | return [ |
| 21 | ...urls, |
| 22 | ...message.attachments.map((attachment) => attachment.url), |
| 23 | ].filter(isImage); |
| 24 | }); |
| 25 | |
| 26 | return unique(array.flat()); |
| 27 | } |