MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / getPropType

Function getPropType

examples/simple/react.js:12739–12751  ·  view source on GitHub ↗
(propValue)

Source from the content-addressed store, hash-verified

12737
12738// Equivalent of `typeof` but with special handling for array and regexp.
12739function getPropType(propValue) {
12740 var propType = typeof propValue;
12741 if (Array.isArray(propValue)) {
12742 return 'array';
12743 }
12744 if (propValue instanceof RegExp) {
12745 // Old webkits (at least until Android 4.0) return 'function' rather than
12746 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
12747 // passes PropTypes.object.
12748 return 'object';
12749 }
12750 return propType;
12751}
12752
12753// This handles more types than `getPropType`. Only used for error messages.
12754// See `createPrimitiveTypeChecker`.

Callers 2

validateFunction · 0.85
getPreciseTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected