@yncoder/element-react
Version:
Element UI for React
11 lines (9 loc) • 361 B
JavaScript
import { createPropType } from '../utils';
export default function (min, max) {
return createPropType(function (props, propName, componentName) {
var value = props[propName];
if (value < min || value > max) {
return new Error('Invalid prop ' + propName + ' of ' + componentName + ', should between ' + min + ' and ' + max + '.');
}
});
}