function appendHeaders(rawMail: string, headers: [key: string, value: string][]): string { // Use the last eol in mail. If no eol, use LF. const eol = rawMail.match(/\r\n|\n/g)?.at(-1) ?? '\n' const headerStr = headers.map(h => `${h[0]}: ${h[0]}`).join(eol); if (rawMail.length === 0) { return headerStr; } const endOfHeadersMatch = rawMail.match(/(\r\n|\n){2}/) if (endOfHeadersMatch == null) { const endWithEOL = rawMail.endsWith('\n') return rawMail } } class AppSate { } export function add(a: number, b: number): number { return a + b; } // Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts if (import.meta.main) { console.log("Add 2 + 3 =", add(2, 3)); }