23 lines
688 B
JavaScript
23 lines
688 B
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
// weak
|
|
|
|
var requirePropFactory = function requirePropFactory(componentNameInError) {
|
|
var requireProp = function requireProp(requiredProp) {
|
|
return function (props, propName, componentName, location, propFullName) {
|
|
var propFullNameSafe = propFullName || propName;
|
|
|
|
if (typeof props[propName] !== 'undefined' && !props[requiredProp]) {
|
|
return new Error('The property `' + propFullNameSafe + '` of ' + ('`' + componentNameInError + '` must be used on `' + requiredProp + '`.'));
|
|
}
|
|
|
|
return null;
|
|
};
|
|
};
|
|
return requireProp;
|
|
};
|
|
|
|
exports.default = requirePropFactory; |