(propValue)
| 717 | |
| 718 | // Equivalent of `typeof` but with special handling for array and regexp. |
| 719 | function getPropType(propValue) { |
| 720 | var propType = typeof propValue; |
| 721 | if (Array.isArray(propValue)) { |
| 722 | return 'array'; |
| 723 | } |
| 724 | if (propValue instanceof RegExp) { |
| 725 | // Old webkits (at least until Android 4.0) return 'function' rather than |
| 726 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ |
| 727 | // passes PropTypes.object. |
| 728 | return 'object'; |
| 729 | } |
| 730 | if (isSymbol(propType, propValue)) { |
| 731 | return 'symbol'; |
| 732 | } |
| 733 | return propType; |
| 734 | } |
| 735 | |
| 736 | // This handles more types than `getPropType`. Only used for error messages. |
| 737 | // See `createPrimitiveTypeChecker`. |
no test coverage detected
searching dependent graphs…