( data: Object | null, isPathAllowed: (path: Array<string | number>) => boolean, path: Array<string | number> = [], )
| 27 | } |
| 28 | |
| 29 | export 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 | |
| 55 | export function copyWithDelete( |
| 56 | obj: Object | Array<any>, |
no test coverage detected