mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = exactProp;
|
|
exports.specialProperty = void 0;
|
|
|
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
|
|
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
|
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
// the module was forked.
|
|
// Only exported for test purposes.
|
|
var specialProperty = "exact-prop: \u200B";
|
|
exports.specialProperty = specialProperty;
|
|
|
|
function exactProp(propTypes) {
|
|
if (process.env.NODE_ENV === 'production') {
|
|
return propTypes;
|
|
}
|
|
|
|
return (0, _extends3.default)({}, propTypes, (0, _defineProperty2.default)({}, specialProperty, function (props) {
|
|
var unsupportedProps = Object.keys(props).filter(function (prop) {
|
|
return !propTypes.hasOwnProperty(prop);
|
|
});
|
|
|
|
if (unsupportedProps.length > 0) {
|
|
return new Error("The following props are not supported: ".concat(unsupportedProps.map(function (prop) {
|
|
return "`".concat(prop, "`");
|
|
}).join(', '), ". Please remove them."));
|
|
}
|
|
|
|
return null;
|
|
}));
|
|
} |