react-adopt
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),isAllElementValid=function(e){return!e.some(function(e){return!React.isValidElement(e)})};function adopt(e){if(!isAllElementValid(Object.values(e)))throw Error("The render props object mapper just accept valid elements as value");return Object.keys(e).reduce(function(t,n){return function(r){var c=r.children;return React.createElement(t,null,function(t){return React.cloneElement(e[n],{children:function(e){return c&&"function"==typeof c&&c(Object.assign({},t,((r={})[n]=e,r)));var r}})})}},function(e){var t=e.children;return t&&"function"==typeof t&&t()})}exports.adopt=adopt; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),__assign=Object.assign||function(e){for(var r,n=1,t=arguments.length;t>n;n++)for(var i in r=arguments[n])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e};function __rest(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&0>r.indexOf(t)&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);t.length>i;i++)0>r.indexOf(t[i])&&(n[t[i]]=e[t[i]])}return n}var values=Object.values,keys=Object.keys,assign=Object.assign;function omit(e,r){return keys(e).filter(function(e){return-1===r.indexOf(e)}).reduce(function(r,n){return __assign({},r,((t={})[n]=e[n],t));var t},{})}var isFn=function(e){return!!e&&"function"==typeof e},isValidRenderProp=function(e){return React.isValidElement(e)||isFn(e)};function adopt(e){if(!values(e).some(isValidRenderProp))throw Error("The render props object mapper just accept valid elements as value");return keys(e).reduce(function(r,n){return function(t){var i=t.children,s=__rest(t,["children"]);return React.createElement(r,__assign({},s),function(r){var t=e[n],a=omit(r,keys(s)),o=function(e){return isFn(i)&&i(assign({},a,((r={})[n]=e,r)));var r};return isFn(t)?React.createElement(t,assign({},s,r,{render:o})):React.cloneElement(t,null,o)})}},function(e){var r=e.children,n=__rest(e,["children"]);return isFn(r)&&r(n)})}exports.adopt=adopt; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-adopt", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"main": "dist/index.js", | ||
@@ -49,2 +49,3 @@ "umd:main": "dist/index.umd.js", | ||
"react-dom": "^16.3.0", | ||
"react-powerplug": "^0.1.5", | ||
"ts-jest": "^22.4.2", | ||
@@ -51,0 +52,0 @@ "ts-node": "^5.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
213385
23
253
21
4