Skip to content

Commit

Permalink
Lodash: Refactor away from _.flatten() (#41733)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla authored Jun 16, 2022
1 parent c776a0d commit d35f8b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = {
'dropRight',
'each',
'findIndex',
'flatten',
'isArray',
'isFinite',
'isFunction',
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-post/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import createSelector from 'rememo';
import { includes, some, flatten, values } from 'lodash';
import { includes, some, values } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -410,7 +410,7 @@ export function getMetaBoxesPerLocation( state, location ) {
*/
export const getAllMetaBoxes = createSelector(
( state ) => {
return flatten( values( state.metaBoxes.locations ) );
return values( state.metaBoxes.locations ).flat();
},
( state ) => [ state.metaBoxes.locations ]
);
Expand Down
3 changes: 1 addition & 2 deletions packages/editor/src/components/page-attributes/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
debounce,
repeat,
find,
flatten,
deburr,
} from 'lodash';

Expand Down Expand Up @@ -111,7 +110,7 @@ export function PageAttributesParent() {
return priorityA >= priorityB ? 1 : -1;
} );

return flatten( sortedNodes );
return sortedNodes.flat();
};

let tree = pageItems.map( ( item ) => ( {
Expand Down

0 comments on commit d35f8b0

Please sign in to comment.