From c06227e7d0c8dfad122d1e0a0eefd5f6ccf232dc Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 23 Jun 2024 15:38:10 -0300 Subject: [PATCH] refactor: Simplify getJsApiCode utility function Simplify the getJsApiCode utility function in the get-js-api-code.tsx file. The unnecessary replacement of JavaScript boolean literals has been removed, improving code readability and maintainability. --- src/frontend/src/modals/apiModal/utils/get-js-api-code.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/frontend/src/modals/apiModal/utils/get-js-api-code.tsx b/src/frontend/src/modals/apiModal/utils/get-js-api-code.tsx index d46653a63..e49817d81 100644 --- a/src/frontend/src/modals/apiModal/utils/get-js-api-code.tsx +++ b/src/frontend/src/modals/apiModal/utils/get-js-api-code.tsx @@ -18,11 +18,8 @@ export default function getJsApiCode( if (!tweaksObject) { throw new Error("Expected tweaks object is not provided."); } - tweaksString = JSON.stringify(tweaksObject, null, 2) - .replace(/true/g, "true") // Ensuring JavaScript boolean literals are correctly formatted - .replace(/false/g, "false"); + tweaksString = JSON.stringify(tweaksObject, null, 2); } - return `class LangflowClient { constructor(baseURL, apiKey) { this.baseURL = baseURL;