react-curry
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -0,1 +1,7 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _react = require('react'); | ||
@@ -9,11 +15,9 @@ | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
exports.default = function (ComponentOrElementName, preProps) { | ||
return typeof ComponentOrElementName === 'string' ? function (props) { | ||
return _react2.default.createElement.apply(_react2.default, [ComponentOrElementName].concat(_toConsumableArray((0, _lodash.merge)(preProps, props)))); | ||
return _react2.default.createElement(ComponentOrElementName, (0, _lodash.merge)(preProps, props)); | ||
} : function (props) { | ||
return _react2.default.createElement(Component, (0, _lodash.merge)(preProps, props)); | ||
return _react2.default.createElement(ComponentOrElementName, (0, _lodash.merge)(preProps, props)); | ||
}; | ||
}; | ||
}; |
{ | ||
"name": "react-curry", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "react stateless component curry", | ||
@@ -5,0 +5,0 @@ "main": "./lib2/index.js", |
@@ -5,6 +5,6 @@ import React from 'react'; | ||
export default (ComponentOrElementName, preProps) => { | ||
return (typeof ComponentOrElementName === 'string') | ||
? (props) => React.createElement(ComponentOrElementName, ...merge(preProps, props)) | ||
: (props) => <Component {...merge(preProps, props)} /> | ||
? (props) => React.createElement(ComponentOrElementName, merge(preProps, props)) | ||
: (props) => <ComponentOrElementName {...merge(preProps, props)} /> | ||
}; |
38
44497