react-ui-icheck
Version:
iCheck customizable checkboxes and radios built with React.
35 lines (30 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = deprecated;
/**
* Wraps a PropTypes.[type] with a console deprecation warning call.
*
* @param {Function} propType PropType type
* @param {String} replacement Replacement property
*
* @returns {Function} PropType
*/
function deprecated(propType, replacement) {
var warned = [];
return function (props, propName, componentName) {
if (props[propName] != null) {
var message = "\"".concat(propName, "\" property of \"").concat(componentName, "\" has been deprecated and will be") + " removed in the future releases. Please use the \"".concat(replacement, "\" instead.");
if (!warned[message]) {
// eslint-disable-next-line no-console
console.warn(message);
warned[message] = true;
}
}
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
rest[_key - 3] = arguments[_key];
}
return propType.apply(void 0, [props, propName, componentName].concat(rest));
};
}