Skip to content

Commit

Permalink
Lodash: Remove _.mapValues() from block editor
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Apr 6, 2023
1 parent 14f1ea8 commit 3eff9f7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/block-editor/src/hooks/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { isEmpty, mapValues, get } from 'lodash';
import { isEmpty, get } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -31,9 +31,9 @@ export const cleanEmptyObject = ( object ) => {
return object;
}
const cleanedNestedObjects = Object.fromEntries(
Object.entries( mapValues( object, cleanEmptyObject ) ).filter(
( [ , value ] ) => Boolean( value )
)
Object.entries( object )
.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )
.filter( ( [ , value ] ) => Boolean( value ) )
);
return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
};
Expand Down

0 comments on commit 3eff9f7

Please sign in to comment.