Skip to content

Commit

Permalink
add jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Jun 11, 2024
1 parent 03bb551 commit 4ff6bf8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default async function publish(ntfyMessage) {
}
}
const fileData = hasLocalAttachment
? await fs.readFile(ntfyMessage.fileAttachmentURL)
?
await fs.readFile(ntfyMessage.fileAttachmentURL)
: undefined;
if (ntfyMessage.fileName !== undefined) {
messageHeaders.Filename = ntfyMessage.fileName;
Expand Down
11 changes: 7 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable security/detect-non-literal-fs-filename */

import fs from 'node:fs/promises'

import type {
Expand All @@ -12,6 +9,11 @@ import type {
export const DEFAULT_SERVER = 'https://ntfy.sh'
export const DEFAULT_PRIORITY: NtfyMessagePriority = 'default'

/**
* Send a message through an ntfy server.
* @param ntfyMessage The message to post.
* @returns True if the message was posted successfully.
*/
export default async function publish(
ntfyMessage: NtfyMessageOptions
): Promise<boolean> {
Expand Down Expand Up @@ -65,7 +67,8 @@ export default async function publish(
}

const fileData = hasLocalAttachment
? await fs.readFile(ntfyMessage.fileAttachmentURL as string)
? // eslint-disable-next-line security/detect-non-literal-fs-filename
await fs.readFile(ntfyMessage.fileAttachmentURL as string)
: undefined

if (ntfyMessage.fileName !== undefined) {
Expand Down

0 comments on commit 4ff6bf8

Please sign in to comment.