UNPKG

@upyo/core

Version:

Simple email sending library for Node.js, Deno, Bun, and edge functions

13 lines (11 loc) 818 B
//#region src/attachment.ts /** * Checks if the provided value is an {@link Attachment} object. * @param attachment The value to check. * @return `true` if the value is an {@link Attachment}, otherwise `false`. */ function isAttachment(attachment) { return typeof attachment === "object" && attachment !== null && "inline" in attachment && "filename" in attachment && "content" in attachment && "contentType" in attachment && "contentId" in attachment && typeof attachment.inline === "boolean" && typeof attachment.filename === "string" && (attachment.content instanceof Uint8Array || attachment.content instanceof Promise && typeof attachment.content.then === "function") && typeof attachment.contentType === "string" && typeof attachment.contentId === "string"; } //#endregion exports.isAttachment = isAttachment;