import startsWith from "coral-common/utils/startsWith" ; param data export default function purgeMetadata < T > ( data ) { switch ( typeof data ) { case "object" : { if ( data === null ) { return data ; } if ( Array . isArray ( data ) ) { return data . map ( purgeMetadata ) as any ; } const result = { } ; Object . keys ( data ) . filter ( ( k ) => ! startsWith ( k , "__" ) ) . forEach ( ( k ) => { result [ k ] = purgeMetadata ( ( data as any ) [ k ] ) ; } ) ; return result ; } default : return data ; } }