Skip to content

Commit

Permalink
Lodash: Refactor getMergedGlobalStyles() away from _.pick() (#45943)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla authored Nov 23, 2022
1 parent 3a5f1f0 commit 8e93b93
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import { pick } from 'lodash';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -34,15 +29,18 @@ export const getMergedGlobalStyles = (
const baseGlobalColors = {
baseColors: baseGlobalStyles || {},
};
const blockStyleAttributes = pick(
blockAttributes,
BLOCK_STYLE_ATTRIBUTES
const blockStyleAttributes = Object.fromEntries(
Object.entries( blockAttributes ?? {} ).filter( ( [ key ] ) =>
BLOCK_STYLE_ATTRIBUTES.includes( key )
)
);

// This prevents certain wrapper styles from being applied to blocks that
// don't support them yet.
const wrapperPropsStyleFiltered = pick(
wrapperPropsStyle,
BLOCK_STYLE_ATTRIBUTES
const wrapperPropsStyleFiltered = Object.fromEntries(
Object.entries( wrapperPropsStyle ?? {} ).filter( ( [ key ] ) =>
BLOCK_STYLE_ATTRIBUTES.includes( key )
)
);

const mergedStyle = {
Expand Down

0 comments on commit 8e93b93

Please sign in to comment.