@danilandreev/material-docs
Version:
material-docs - react framework for easy creating documentation site in material design style.
40 lines (31 loc) • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.pagesDataValidate = pagesDataValidate;
exports.default = void 0;
var _createChainableTypeChecker = _interopRequireDefault(require("../utils/createChainableTypeChecker"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* pagesDataValidate - type validator for PagesData interface. Used in PagesDataValidator.
* @function
* @param {object} props
* @param {string} propName
* @param {string} componentName
* @returns Error
*/
function pagesDataValidate(prop, propName, componentName) {
if (typeof prop.name !== "string") return Error("Incorrect field 'name' type on prop ".concat(propName, " in component ").concat(componentName, ", expected \"string\", got \"").concat(_typeof(prop.name), "\""));
if (!(typeof prop.link === "string" || _typeof(prop.link) === "object")) return Error("Incorrect field 'link' type on prop ".concat(propName, " in component ").concat(componentName, ", expected \"string | object\", got \"").concat(_typeof(prop.link), "\""));
}
function PagesDataValidator(props, propName, componentName) {
var prop = props[propName];
if (!prop) return null;
return pagesDataValidate(prop, propName, componentName);
}
/**
* PagesDataValidator - PropTypes validator for PagesData interface.
*/
var _default = (0, _createChainableTypeChecker.default)(PagesDataValidator);
exports.default = _default;