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

Function checkType

examples/simple/react.js:12508–12520  ·  view source on GitHub ↗
(isRequired, props, propName, componentName, location, propFullName)

Source from the content-addressed store, hash-verified

12506
12507function createChainableTypeChecker(validate) {
12508 function checkType(isRequired, props, propName, componentName, location, propFullName) {
12509 componentName = componentName || ANONYMOUS;
12510 propFullName = propFullName || propName;
12511 if (props[propName] == null) {
12512 var locationName = ReactPropTypeLocationNames[location];
12513 if (isRequired) {
12514 return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
12515 }
12516 return null;
12517 } else {
12518 return validate(props, propName, componentName, location, propFullName);
12519 }
12520 }
12521
12522 var chainedCheckType = checkType.bind(null, false);
12523 chainedCheckType.isRequired = checkType.bind(null, true);

Callers

nothing calls this directly

Calls 1

validateFunction · 0.85

Tested by

no test coverage detected