33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
var _wrapDisplayName = require('./wrapDisplayName');
|
|
|
|
var _wrapDisplayName2 = _interopRequireDefault(_wrapDisplayName);
|
|
|
|
var _setDisplayName = require('./setDisplayName');
|
|
|
|
var _setDisplayName2 = _interopRequireDefault(_setDisplayName);
|
|
|
|
var _mapProps = require('./mapProps');
|
|
|
|
var _mapProps2 = _interopRequireDefault(_mapProps);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var withProps = function withProps(input) {
|
|
var hoc = (0, _mapProps2.default)(function (props) {
|
|
return _extends({}, props, typeof input === 'function' ? input(props) : input);
|
|
});
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
return function (BaseComponent) {
|
|
return (0, _setDisplayName2.default)((0, _wrapDisplayName2.default)(BaseComponent, 'withProps'))(hoc(BaseComponent));
|
|
};
|
|
}
|
|
return hoc;
|
|
};
|
|
|
|
exports.default = withProps; |