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

Function checkPlotData

lib/v2/edge-runtime/dataAnalysis.ts:571–592  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

569}
570
571export function checkPlotData(data: any): boolean {
572 // data must be an object and not an array
573 if (typeof data !== "object" || data === null || Array.isArray(data)) {
574 console.log("checkPlotData: Data is not an object", data);
575 return false;
576 }
577 if (!["title", "data", "type"].every((keyName) => keyName in data)) {
578 console.log("checkPlotData: Data does not have title, data and type", data);
579 return false;
580 }
581 if (
582 !Array.isArray(data.data) ||
583 data.data.some(
584 (item: any) =>
585 item === null || typeof item !== "object" || Array.isArray(item),
586 )
587 ) {
588 console.log("checkPlotData: Data.data is not an array of objects", data);
589 return false;
590 }
591 return true;
592}
593
594export function formatPlotData(plotMessage: {
595 type: "plot";

Callers 2

checkCodeExecutionOutputFunction · 0.90
checkCodeExecutionOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected