From 40b5015dd50db1428ff1d5ab22620468f12f89e6 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Fri, 7 Apr 2023 12:38:04 +0300 Subject: [PATCH] Lodash: Remove _.mapValues() from block editor (#49638) --- packages/block-editor/src/hooks/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/block-editor/src/hooks/utils.js b/packages/block-editor/src/hooks/utils.js index c7748ef85a7a0e..6db0bad2eb64f0 100644 --- a/packages/block-editor/src/hooks/utils.js +++ b/packages/block-editor/src/hooks/utils.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { isEmpty, mapValues, get } from 'lodash'; +import { isEmpty, get } from 'lodash'; /** * WordPress dependencies @@ -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; };