blob: b4f297df49b9c6be9b27955745b34b2517a441ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
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));
}
|