tinper-bee-core/js/all.js

27 lines
562 B
JavaScript
Raw Normal View History

2019-02-26 11:18:33 +08:00
/**
* This source code is quoted from rc-util.
* homepage: https://github.com/react-component/util
*/
2016-11-17 10:25:54 +08:00
import createChainableTypeChecker from './utils/createChainableTypeChecker';
export default function all(...validators) {
function allPropTypes(...args) {
let error = null;
validators.forEach(validator => {
if (error != null) {
return;
}
const result = validator(...args);
if (result != null) {
error = result;
}
});
return error;
}
return createChainableTypeChecker(allPropTypes);
}