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.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-23 15:38:10 -03:00
commit c06227e7d0

View file

@ -18,11 +18,8 @@ export default function getJsApiCode(
if (!tweaksObject) { if (!tweaksObject) {
throw new Error("Expected tweaks object is not provided."); throw new Error("Expected tweaks object is not provided.");
} }
tweaksString = JSON.stringify(tweaksObject, null, 2) tweaksString = JSON.stringify(tweaksObject, null, 2);
.replace(/true/g, "true") // Ensuring JavaScript boolean literals are correctly formatted
.replace(/false/g, "false");
} }
return `class LangflowClient { return `class LangflowClient {
constructor(baseURL, apiKey) { constructor(baseURL, apiKey) {
this.baseURL = baseURL; this.baseURL = baseURL;