Skip to content

Commit

Permalink
fix: deno fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-schaber committed Jan 27, 2023
1 parent ea65355 commit fe9402b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
14 changes: 7 additions & 7 deletions client/basic/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ export class SMTPClient {
writeCMD("MIME-Version: 1.0");

const boundaryAdditionAtt = calcBoundary(
config.mimeContent.map(v => v.content).join("\n") + "\n"
+ config.attachments.map(v => v.content).join("\n"),
new RegExp("--attachment([0-9]+)", "g")
)
config.mimeContent.map((v) => v.content).join("\n") + "\n" +
config.attachments.map((v) => v.content).join("\n"),
new RegExp("--attachment([0-9]+)", "g"),
);

const attachmentBoundary = `attachment${boundaryAdditionAtt}`;

Expand All @@ -165,9 +165,9 @@ export class SMTPClient {
writeCMD(`--${attachmentBoundary}`);

const boundaryAdditionMsg = calcBoundary(
config.mimeContent.map(v => v.content).join("\n"),
new RegExp("--message([0-9]+)", "g")
)
config.mimeContent.map((v) => v.content).join("\n"),
new RegExp("--message([0-9]+)", "g"),
);

const messageBoundary = `message${boundaryAdditionMsg}`;

Expand Down
8 changes: 2 additions & 6 deletions client/basic/encode/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ type writer = (...args: string[]) => Promise<void>;

export function encodeAttachment(writeCMD: writer, attachment: Attachment) {
writeCMD(
`Content-Type: ${
attachment.contentType
}; name=${
attachment.filename
}`
`Content-Type: ${attachment.contentType}; name=${attachment.filename}`,
);

if (attachment.contentID) {
Expand Down Expand Up @@ -44,7 +40,7 @@ export function encodeAttachment(writeCMD: writer, attachment: Attachment) {
writeCMD("\r\n");
} else if (attachment.encoding === "text") {
writeCMD(
"Content-Transfer-Encoding: quoted-printable\r\n"
"Content-Transfer-Encoding: quoted-printable\r\n",
);

writeCMD(attachment.content + "\r\n");
Expand Down
4 changes: 1 addition & 3 deletions client/basic/encode/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export function encodeContent(writeCMD: writer, content: Content) {
);
if (content.transferEncoding) {
writeCMD(
`Content-Transfer-Encoding: ${
content.transferEncoding
}\r\n`,
`Content-Transfer-Encoding: ${content.transferEncoding}\r\n`,
);
} else {
// Send new line
Expand Down
10 changes: 6 additions & 4 deletions client/basic/encode/related.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ type writer = (...args: string[]) => Promise<void>;

export function encodeRelated(writeCMD: writer, content: Content) {
if (!content.relatedAttachments) {
throw new Error("Content does not contain relatedAttachments. Cannot encode as related.");
throw new Error(
"Content does not contain relatedAttachments. Cannot encode as related.",
);
}

const boundaryAddRel = calcBoundary(
content.content + "\n"
+ content.relatedAttachments.map(v => v.content).join("\n"),
new RegExp("--related([0-9]+)", "g")
content.content + "\n" +
content.relatedAttachments.map((v) => v.content).join("\n"),
new RegExp("--related([0-9]+)", "g"),
);

const relatedBoundary = `related${boundaryAddRel}`;
Expand Down
6 changes: 4 additions & 2 deletions config/mail/content.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolveAttachment, Attachment } from "./attachments.ts";
import { Attachment, resolveAttachment } from "./attachments.ts";
import { quotedPrintableEncode } from "./encoding.ts";

export interface Content {
Expand Down Expand Up @@ -44,7 +44,9 @@ export function resolveContent({
};

if (relatedAttachments) {
newMime.relatedAttachments = relatedAttachments.map(attachment => resolveAttachment(attachment))
newMime.relatedAttachments = relatedAttachments.map((attachment) =>
resolveAttachment(attachment)
);
}
newContent.push(newMime);
}
Expand Down

0 comments on commit fe9402b

Please sign in to comment.