UNPKG

wix-style-react

Version:
36 lines (27 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isStatelessComponent = exports.wrapDisplayName = exports.getDisplayName = void 0; // these are taken from Recompose: // https://github.com/acdlite/recompose/tree/7918e23eebb74dc930e6ff2d32eb1ead4750f061 // // TODO: consider using the Recompose package var getDisplayName = function getDisplayName(Component) { if (typeof Component === 'string') { return Component; } if (!Component) { return undefined; } return Component.displayName || Component.name || 'Component'; }; exports.getDisplayName = getDisplayName; var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) { return "".concat(hocName, "(").concat(getDisplayName(BaseComponent), ")"); }; exports.wrapDisplayName = wrapDisplayName; var isStatelessComponent = function isStatelessComponent(Component) { return !(Component.prototype && Component.prototype.render); }; exports.isStatelessComponent = isStatelessComponent;