Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Replace lodash clamp
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Apr 20, 2023
1 parent 3d51835 commit 6c43bb4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion assets/js/editor-components/grid-layout-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { clamp } from 'lodash';
import PropTypes from 'prop-types';
import { RangeControl, ToggleControl } from '@wordpress/components';

const clamp = ( number, boundOne, boundTwo ) => {
if ( ! boundTwo ) {
return Math.max( number, boundOne ) === boundOne ? number : boundOne;
} else if ( Math.min( number, boundOne ) === number ) {
return boundOne;
} else if ( Math.max( number, boundTwo ) === number ) {
return boundTwo;
}
return number;
};

/**
* A combination of range controls for product grid layout settings.
*
Expand Down

0 comments on commit 6c43bb4

Please sign in to comment.