MCPcopy Create free account
hub / github.com/plotly/dash / createStrictShapeTypeChecker

Function createStrictShapeTypeChecker

dash/deps/prop-types@15.8.1.js:615–645  ·  view source on GitHub ↗
(shapeTypes)

Source from the content-addressed store, hash-verified

613 }
614
615 function createStrictShapeTypeChecker(shapeTypes) {
616 function validate(props, propName, componentName, location, propFullName) {
617 var propValue = props[propName];
618 var propType = getPropType(propValue);
619 if (propType !== 'object') {
620 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
621 }
622 // We need to check all keys in case some are required but missing from props.
623 var allKeys = assign({}, props[propName], shapeTypes);
624 for (var key in allKeys) {
625 var checker = shapeTypes[key];
626 if (has(shapeTypes, key) && typeof checker !== 'function') {
627 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
628 }
629 if (!checker) {
630 return new PropTypeError(
631 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
632 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
633 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
634 );
635 }
636 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
637 if (error) {
638 return error;
639 }
640 }
641 return null;
642 }
643
644 return createChainableTypeChecker(validate);
645 }
646
647 function isNode(propValue) {
648 switch (typeof propValue) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…