MCPcopy
hub / github.com/facebook/react / cleanForBridge

Function cleanForBridge

packages/react-devtools-shared/src/backend/utils/index.js:29–53  ·  view source on GitHub ↗
(
  data: Object | null,
  isPathAllowed: (path: Array<string | number>) => boolean,
  path: Array<string | number> = [],
)

Source from the content-addressed store, hash-verified

27}
28
29export function cleanForBridge(
30 data: Object | null,
31 isPathAllowed: (path: Array<string | number>) => boolean,
32 path: Array<string | number> = [],
33): DehydratedData | null {
34 if (data !== null) {
35 const cleanedPaths: Array<Array<string | number>> = [];
36 const unserializablePaths: Array<Array<string | number>> = [];
37 const cleanedData = dehydrate(
38 data,
39 cleanedPaths,
40 unserializablePaths,
41 path,
42 isPathAllowed,
43 );
44
45 return {
46 data: cleanedData,
47 cleaned: cleanedPaths,
48 unserializable: unserializablePaths,
49 };
50 } else {
51 return null;
52 }
53}
54
55export function copyWithDelete(
56 obj: Object | Array<any>,

Callers 2

inspectElementFunction · 0.90
inspectElementFunction · 0.90

Calls 1

dehydrateFunction · 0.90

Tested by

no test coverage detected