src/EditableTree.js
/**
 * Deeply removes nulls and empty objects in an object
 */
Deeply removes nulls and empty objects in an object
Deeply removes nulls and empty objects in an object
function cleanupObject(o) {
  if (o === null || o === undefined || typeof o !== 'object') {
    return o;
  }
  for (let k of Object.keys(o)) {
    o[k] = cleanupObject(o[k]);
    if (o[k] === null || o[k] === undefined) {
      delete o[k];
    }
  }
  return Object.keys(o).filter(k => !k.startsWith('_')).length ? o : null;
}
function cleanupObject ( o ) { if ( o === null || o === undefined || typeof o !== 'object' ) { return o ; } for ( let k of Object . keys ( o ) ) { o [ k ] = cleanupObject ( o [ k ] ) ; if ( o [ k ] === null || o [ k ] === undefined ) { delete o [ k ] ; } } return Object . keys ( o ) . filter ( k => ! k . startsWith ( '_' ) ) . length ? o : null ; }
Deeply removes nulls and empty objects in an object
Deeply removes nulls and empty objects in an object