MCPcopy
hub / github.com/t4t5/sweetalert / createPrimitiveTypeChecker

Function createPrimitiveTypeChecker

docs/assets/js/index.js:64844–64859  ·  view source on GitHub ↗
(expectedType)

Source from the content-addressed store, hash-verified

64842 }
64843
64844 function createPrimitiveTypeChecker(expectedType) {
64845 function validate(props, propName, componentName, location, propFullName, secret) {
64846 var propValue = props[propName];
64847 var propType = getPropType(propValue);
64848 if (propType !== expectedType) {
64849 // `propValue` being instance of, say, date/regexp, pass the 'object'
64850 // check, but we can offer a more precise error message here rather than
64851 // 'of type `object`'.
64852 var preciseType = getPreciseType(propValue);
64853
64854 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
64855 }
64856 return null;
64857 }
64858 return createChainableTypeChecker(validate);
64859 }
64860
64861 function createAnyTypeChecker() {
64862 return createChainableTypeChecker(emptyFunction.thatReturnsNull);

Callers 1

index.jsFile · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…