1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | 'use strict';
|
9 |
|
10 | var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
11 |
|
12 | function emptyFunction() {}
|
13 |
|
14 | module.exports = function() {
|
15 | function shim(props, propName, componentName, location, propFullName, secret) {
|
16 | if (secret === ReactPropTypesSecret) {
|
17 |
|
18 | return;
|
19 | }
|
20 | var err = new Error(
|
21 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
22 | 'Use PropTypes.checkPropTypes() to call them. ' +
|
23 | 'Read more at http://fb.me/use-check-prop-types'
|
24 | );
|
25 | err.name = 'Invariant Violation';
|
26 | throw err;
|
27 | };
|
28 | shim.isRequired = shim;
|
29 | function getShim() {
|
30 | return shim;
|
31 | };
|
32 |
|
33 |
|
34 | var ReactPropTypes = {
|
35 | array: shim,
|
36 | bool: shim,
|
37 | func: shim,
|
38 | number: shim,
|
39 | object: shim,
|
40 | string: shim,
|
41 | symbol: shim,
|
42 |
|
43 | any: shim,
|
44 | arrayOf: getShim,
|
45 | element: shim,
|
46 | instanceOf: getShim,
|
47 | node: shim,
|
48 | objectOf: getShim,
|
49 | oneOf: getShim,
|
50 | oneOfType: getShim,
|
51 | shape: getShim,
|
52 | exact: getShim
|
53 | };
|
54 |
|
55 | ReactPropTypes.checkPropTypes = emptyFunction;
|
56 | ReactPropTypes.PropTypes = ReactPropTypes;
|
57 |
|
58 | return ReactPropTypes;
|
59 | };
|