Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lodash: Refactor away from _.dropRight() #41654

Merged
merged 2 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module.exports = {
name: 'lodash',
importNames: [
'differenceWith',
'dropRight',
'findIndex',
'isUndefined',
'memoize',
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import classnames from 'classnames';
import { dropRight, get, times } from 'lodash';
import { get, times } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -199,9 +199,9 @@ const ColumnsEditContainerWrapper = withDispatch(
];
} else {
// The removed column will be the last of the inner blocks.
innerBlocks = dropRight(
innerBlocks,
previousColumns - newColumns
innerBlocks = innerBlocks.slice(
0,
-( previousColumns - newColumns )
);

if ( hasExplicitWidths ) {
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/columns/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { View, Dimensions } from 'react-native';
import { dropRight, times, map, compact, delay } from 'lodash';
import { times, map, compact, delay } from 'lodash';
/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -394,9 +394,9 @@ const ColumnsEditContainerWrapper = withDispatch(
];
} else {
// The removed column will be the last of the inner blocks.
innerBlocks = dropRight(
innerBlocks,
previousColumns - newColumns
innerBlocks = innerBlocks.slice(
0,
-( previousColumns - newColumns )
);

if ( hasExplicitWidths ) {
Expand Down