react-input-range
Version:
React component for inputting numeric values within a range
19 lines (15 loc) • 476 B
JavaScript
import { isNumber } from '../utils';
/**
* @ignore
* @param {Object} props - React component props
* @return {?Error} Return Error if validation fails
*/
export default function rangePropType(props) {
const { maxValue, minValue } = props;
if (!isNumber(minValue) || !isNumber(maxValue)) {
return new Error('"minValue" and "maxValue" must be a number');
}
if (minValue >= maxValue) {
return new Error('"minValue" must be smaller than "maxValue"');
}
}