@shopify/react-compose
Version:
Cleanly compose multiple component enhancers together with minimal fuss
19 lines (12 loc) • 665 B
JavaScript
Object.defineProperty(exports, '__esModule', { value: true });
var hoistStatics = require('hoist-non-react-statics');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var hoistStatics__default = /*#__PURE__*/_interopDefaultLegacy(hoistStatics);
function compose(...wrappingFunctions) {
return function wrapComponent(OriginalComponent) {
const result = wrappingFunctions.reduceRight((component, wrappingFunction) => wrappingFunction(component), OriginalComponent);
return hoistStatics__default["default"](result, OriginalComponent);
};
}
exports["default"] = compose;
;