UNPKG

765 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = requirePropFactory;
7
8function requirePropFactory(componentNameInError) {
9 if (process.env.NODE_ENV === 'production') {
10 return function () {
11 return null;
12 };
13 }
14
15 var requireProp = function requireProp(requiredProp) {
16 return function (props, propName, componentName, location, propFullName) {
17 var propFullNameSafe = propFullName || propName;
18
19 if (typeof props[propName] !== 'undefined' && !props[requiredProp]) {
20 return new Error("The prop `".concat(propFullNameSafe, "` of ") + "`".concat(componentNameInError, "` must be used on `").concat(requiredProp, "`."));
21 }
22
23 return null;
24 };
25 };
26
27 return requireProp;
28}
\No newline at end of file