From 0472605a4b04de423e1df7ad5acac6444e24097b Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 08:19:10 +0000 Subject: [PATCH 1/2] Adds the appropriate return type for the method or function --- src/handlers/encryption.ts | 4 +++- src/helpers/pluralize.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/handlers/encryption.ts b/src/handlers/encryption.ts index 4624d74..7c81347 100644 --- a/src/handlers/encryption.ts +++ b/src/handlers/encryption.ts @@ -4,7 +4,9 @@ import { secretKey, algorithm } from "@config/encryption"; const iv = crypto.randomBytes(16); -const encrypt = (text: any) => { +const encrypt = (text: any): {iv: error; +content: error; +} => { const cipher = crypto.createCipheriv(algorithm, secretKey, iv); const encrypted = Buffer.concat([cipher.update(text), cipher.final()]); diff --git a/src/helpers/pluralize.ts b/src/helpers/pluralize.ts index c255427..491393b 100644 --- a/src/helpers/pluralize.ts +++ b/src/helpers/pluralize.ts @@ -1,6 +1,6 @@ import logger from "@root/logger"; -export default (count: number, noun: string, suffix?: string) => { +export default (count: number, noun: string, suffix?: string): string => { const result = `${count} ${noun}${count !== 1 ? suffix || "s" : ""}`; logger?.verbose(`Pluralized ${count} to ${result}`); return result; From 6fb549946a5e9dc83ce2789f790123315ba7dd23 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 08:19:22 +0000 Subject: [PATCH 2/2] Format code with standardjs and prettier --- src/handlers/encryption.ts | 4 +--- src/helpers/pluralize.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/handlers/encryption.ts b/src/handlers/encryption.ts index 7c81347..5e07d89 100644 --- a/src/handlers/encryption.ts +++ b/src/handlers/encryption.ts @@ -4,9 +4,7 @@ import { secretKey, algorithm } from "@config/encryption"; const iv = crypto.randomBytes(16); -const encrypt = (text: any): {iv: error; -content: error; -} => { +const encrypt = (text: any): { iv: error; content: error } => { const cipher = crypto.createCipheriv(algorithm, secretKey, iv); const encrypted = Buffer.concat([cipher.update(text), cipher.final()]); diff --git a/src/helpers/pluralize.ts b/src/helpers/pluralize.ts index 491393b..c9ad1ad 100644 --- a/src/helpers/pluralize.ts +++ b/src/helpers/pluralize.ts @@ -1,6 +1,6 @@ import logger from "@root/logger"; -export default (count: number, noun: string, suffix?: string): string => { +export default (count: number, noun: string, suffix?: string): string => { const result = `${count} ${noun}${count !== 1 ? suffix || "s" : ""}`; logger?.verbose(`Pluralized ${count} to ${result}`); return result;