MCPcopy Create free account
hub / github.com/LearnPrompt/LearnPrompt / encodeUrlConfig

Function encodeUrlConfig

scripts/dyno_to_new_embed.ts:37–43  ·  view source on GitHub ↗
(obj: UrlConfig)

Source from the content-addressed store, hash-verified

35type UrlConfig = yup.InferType<typeof urlConfigSchema>;
36
37const encodeUrlConfig = (obj: UrlConfig): string => {
38 let str = JSON.stringify(obj, (key, value) => typeof value === 'string' ? he.decode(value.replace(/\\n/g, '\n')) : value);
39 let encoder = new TextEncoder();
40 let data = encoder.encode(str);
41 let base64 = btoa(String.fromCharCode.apply(null, data as any));
42 return encodeURIComponent(base64);
43}
44
45const JSX_TEMPLATE = `<iframe
46 src="%URL%"

Callers 1

createEmbedCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected