33 lines
1.1 KiB
JavaScript
33 lines
1.1 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 _react = require('react');
|
|
|
|
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 flattenProp = function flattenProp(propName) {
|
|
return function (BaseComponent) {
|
|
var factory = (0, _react.createFactory)(BaseComponent);
|
|
var FlattenProp = function FlattenProp(props) {
|
|
return factory(_extends({}, props, props[propName]));
|
|
};
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
return (0, _setDisplayName2.default)((0, _wrapDisplayName2.default)(BaseComponent, 'flattenProp'))(FlattenProp);
|
|
}
|
|
return FlattenProp;
|
|
};
|
|
};
|
|
|
|
exports.default = flattenProp; |