MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / getParam

Function getParam

supabase/functions/execute-code-2/utils.ts:152–171  ·  view source on GitHub ↗
(
  parameters: Record<string, any>,
  key: string,
  allowObjects: boolean = false,
)

Source from the content-addressed store, hash-verified

150}
151
152export function getParam(
153 parameters: Record<string, any>,
154 key: string,
155 allowObjects: boolean = false,
156): any {
157 let out: any = undefined;
158 if (key in parameters) out = parameters[key];
159 if (!out) {
160 // Sometimes (rarely) the AI replaces hyphens with underscores. This is a hacky fix
161 const found = Object.keys(parameters).find(
162 (k) => k.replace(/-/g, "_") === key.replace(/-/g, "_"),
163 );
164 if (found) out = parameters[found];
165 }
166 if (out === undefined) return undefined;
167 if (allowObjects && typeof out === "object") {
168 return JSON.stringify(out);
169 }
170 return out;
171}
172
173export function parseErrorHtml(str: string): string {
174 const elements = [];

Callers 2

constructHttpRequestFunction · 0.90
buildBodyFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected