1 | 'use strict';
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports['default'] = all;
|
5 |
|
6 | function all() {
|
7 | for (var _len = arguments.length, propTypes = Array(_len), _key = 0; _key < _len; _key++) {
|
8 | propTypes[_key] = arguments[_key];
|
9 | }
|
10 |
|
11 | if (propTypes === undefined) {
|
12 | throw new Error('No validations provided');
|
13 | }
|
14 |
|
15 | if (propTypes.some(function (propType) {
|
16 | return typeof propType !== 'function';
|
17 | })) {
|
18 | throw new Error('Invalid arguments, must be functions');
|
19 | }
|
20 |
|
21 | if (propTypes.length === 0) {
|
22 | throw new Error('No validations provided');
|
23 | }
|
24 |
|
25 | return function validate(props, propName, componentName) {
|
26 | for (var i = 0; i < propTypes.length; i++) {
|
27 | var result = propTypes[i](props, propName, componentName);
|
28 |
|
29 | if (result !== undefined && result !== null) {
|
30 | return result;
|
31 | }
|
32 | }
|
33 | };
|
34 | }
|
35 |
|
36 | module.exports = exports['default']; |
\ | No newline at end of file |