Skip to content

Commit

Permalink
Lodash: Refactor away from _.isFinite()
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Jun 10, 2022
1 parent 2fa50a6 commit 7965e66
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module.exports = {
importNames: [
'differenceWith',
'findIndex',
'isFinite',
'isUndefined',
'memoize',
'negate',
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/paragraph/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import classnames from 'classnames';
import { isFinite, omit } from 'lodash';
import { omit } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -328,7 +328,7 @@ const deprecated = [
return migrateCustomColorsAndFontSizes(
omit( {
...attributes,
customFontSize: isFinite( attributes.fontSize )
customFontSize: Number.isFinite( attributes.fontSize )
? attributes.fontSize
: undefined,
customTextColor:
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/range-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* External dependencies
*/
import classnames from 'classnames';
import { clamp, isFinite, noop } from 'lodash';
import { clamp, noop } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -121,7 +121,7 @@ function RangeControl(

const id = useInstanceId( RangeControl, 'inspector-range-control' );
const describedBy = !! help ? `${ id }__help` : undefined;
const enableTooltip = showTooltipProp !== false && isFinite( value );
const enableTooltip = showTooltipProp !== false && Number.isFinite( value );

const handleOnRangeChange = ( event ) => {
const nextValue = parseFloat( event.target.value );
Expand Down

0 comments on commit 7965e66

Please sign in to comment.