From b57702b414062643fea501d800336a8956de55f6 Mon Sep 17 00:00:00 2001 From: Sparticuz Date: Mon, 27 Mar 2023 09:21:44 -0400 Subject: [PATCH] Make sure the awslambda check only returns a boolean --- source/helper.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/helper.ts b/source/helper.ts index fa19998..5d1c673 100644 --- a/source/helper.ts +++ b/source/helper.ts @@ -17,9 +17,19 @@ export const isValidUrl = (input: string) => { } }; -export const isRunningInAwsLambda = () => - process.env.AWS_EXECUTION_ENV && - /^AWS_Lambda_nodejs/.test(process.env.AWS_EXECUTION_ENV) === true; +/** + * Determines if the running instance is inside an AWS Lambda container. + * @returns + */ +export const isRunningInAwsLambda = () => { + if ( + process.env.AWS_EXECUTION_ENV && + /^AWS_Lambda_nodejs/.test(process.env.AWS_EXECUTION_ENV) === true + ) { + return true; + } + return false; +}; export const downloadAndExtract = async (url: string) => new Promise((resolve, reject) => {