35 lines
999 B
JavaScript
35 lines
999 B
JavaScript
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _shouldUpdate = require('./shouldUpdate');
|
|
|
|
var _shouldUpdate2 = _interopRequireDefault(_shouldUpdate);
|
|
|
|
var _shallowEqual = require('./shallowEqual');
|
|
|
|
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
|
|
|
|
var _setDisplayName = require('./setDisplayName');
|
|
|
|
var _setDisplayName2 = _interopRequireDefault(_setDisplayName);
|
|
|
|
var _wrapDisplayName = require('./wrapDisplayName');
|
|
|
|
var _wrapDisplayName2 = _interopRequireDefault(_wrapDisplayName);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var pure = function pure(BaseComponent) {
|
|
var hoc = (0, _shouldUpdate2.default)(function (props, nextProps) {
|
|
return !(0, _shallowEqual2.default)(props, nextProps);
|
|
});
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
return (0, _setDisplayName2.default)((0, _wrapDisplayName2.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
|
|
}
|
|
|
|
return hoc(BaseComponent);
|
|
};
|
|
|
|
exports.default = pure; |