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

Function swapKeysValues

lib/utils.ts:426–440  ·  view source on GitHub ↗
(json: { [key: string]: string })

Source from the content-addressed store, hash-verified

424}
425
426export function swapKeysValues(json: { [key: string]: string }) {
427 const keyValCount = Object.keys(json).length;
428 const ret: { [key: string]: string } = {};
429 for (const key in json) {
430 ret[json[key]] = key;
431 }
432 if (Object.keys(ret).length !== keyValCount) {
433 console.warn(
434 `swapKeysValues() failed sanity check: started with ${keyValCount} key-val pairs, ended with ${Object.keys(
435 ret.length,
436 )}`,
437 );
438 }
439 return ret;
440}
441
442const absoluteChecker = new RegExp("^(?:[a-z+]+:)?//", "i");
443export function isUrlRelative(url: string): boolean {

Callers 2

streamResponseToUserFunction · 0.90
repopulateVariablesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected