Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
primogenial
/
wp-content-20241001222009
/
plugins
/
woocommerce
/
packages
/
woocommerce-blocks
/
assets
/
js
/
base
/
components
/
price-slider
:
utils.ts
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * External dependencies */ import type { NumberFormatValues } from 'react-number-format'; /** Check if that the value is minor than the max price and greater than 0. */ export const isValidMaxValue = ( { maxConstraint, minorUnit, }: { maxConstraint: number; minorUnit: number; } ) => ( { floatValue }: NumberFormatValues ): boolean => { const maxPrice = maxConstraint / 10 ** minorUnit; return ( floatValue !== undefined && floatValue <= maxPrice && floatValue > 0 ); }; /** Check if that the value is minor than the max price and greater than 0. */ export const isValidMinValue = ( { minConstraint, currentMaxValue, minorUnit, }: { minConstraint: number; currentMaxValue: number; minorUnit: number; } ) => ( { floatValue }: NumberFormatValues ): boolean => { const minPrice = minConstraint / 10 ** minorUnit; const currentMaxPrice = currentMaxValue / 10 ** minorUnit; return ( floatValue !== undefined && floatValue >= minPrice && floatValue < currentMaxPrice ); };