Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-adopt

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-adopt - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

8

dist/index.d.ts

@@ -6,3 +6,4 @@ /// <reference types="react" />

export declare type RPC<RP, P = {}> = React.SFC<P & {
children: ChildrenFn<RP>;
children?: ChildrenFn<RP>;
render?: ChildrenFn<RP>;
}>;

@@ -13,3 +14,3 @@ export declare type MapperComponent<RP, P> = React.SFC<RP & P & {

export declare type MapperValue<RP, P> = ReactElement<any> | MapperComponent<RP, P>;
export declare type Mapper<RP, P> = Record<keyof RP, MapperValue<RP, P>>;
export declare type Mapper<RP, P> = Record<string, MapperValue<RP, P>>;
export declare type MapProps<RP> = (props: any) => RP;

@@ -19,3 +20,4 @@ export declare function adopt<RP = any, P = any>(mapper: Mapper<RP, P>, mapProps?: MapProps<RP>): RPC<RP, P>;

mapper: Mapper<RP, P>;
children: ChildrenFn<RP>;
children?: ChildrenFn<RP>;
render?: ChildrenFn<RP>;
mapProps?: MapProps<RP>;

@@ -22,0 +24,0 @@ };

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=_interopDefault(require("react")),extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);n.length>o;o++)0>t.indexOf(n[o])&&(r[n[o]]=e[n[o]])}return r}var values=Object.values,keys=Object.keys,assign=Object.assign;function omit(e,t){return keys(t).filter(function(t){return-1===e.indexOf(t)}).reduce(function(e,r){return __assign({},e,((n={})[r]=t[r],n));var n},{})}function prop(e,t){return t[e]}var isFn=function(e){return!!e&&"function"==typeof e},isValidRenderProp=function(e){return React.isValidElement(e)||isFn(e)};function adopt(e,t){if(!values(e).some(isValidRenderProp))throw Error("The render props object mapper just accept valid elements as value");var r=keys(e);return r.reduce(function(n,o,i){return function(a){var s=a.children,c=__rest(a,["children"]);return React.createElement(n,__assign({},c),function(n){var a=prop(o,e),p=omit(keys(c),n),u=i===r.length-1,f=function(e){var r,n=assign({},p,((r={})[o]=e,r));return isFn(s)?s(t&&isFn(t)&&u?t(n):n):null};return isFn(a)?React.createElement(a,assign({},c,n,{render:f})):React.cloneElement(a,{},f)})}},function(e){var t=e.children,r=__rest(e,["children"]);return isFn(t)&&t(r)})}var Adopt=function(e){function t(t){var r=e.call(this,t)||this;return r.Composed=adopt(t.mapper,r.props.mapProps),r}return __extends(t,e),t.prototype.render=function(){var e=this.props,t=__rest(e,["mapper","mapProps"]);return React.createElement(this.Composed,__assign({},t))},t}(React.Component);exports.adopt=adopt,exports.Adopt=Adopt;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=_interopDefault(require("react")),extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);n.length>o;o++)0>t.indexOf(n[o])&&(r[n[o]]=e[n[o]])}return r}var values=Object.values,keys=Object.keys,assign=Object.assign;function omit(e,t){return keys(t).filter(function(t){return-1===e.indexOf(t)}).reduce(function(e,r){return __assign({},e,((n={})[r]=t[r],n));var n},{})}function prop(e,t){return t[e]}var isFn=function(e){return!!e&&"function"==typeof e},isValidRenderProp=function(e){return React.isValidElement(e)||isFn(e)};function adopt(e,t){if(!values(e).some(isValidRenderProp))throw Error("The render props object mapper just accept valid elements as value");var r=keys(e);return r.reduce(function(n,o,i){return function(s){var a=s.render,c=s.children,p=__rest(s,["render","children"]);return React.createElement(n,__assign({},p),function(n){var s=prop(o,e),u=omit(keys(p),n),f=i===r.length-1,l=a&&isFn(a)?a:c,d=function(e){var r,n=assign({},u,((r={})[o]=e,r)),i=t&&isFn(t)&&f?t(n):n;return l&&isFn(l)?l(i):null};return isFn(s)?React.createElement(s,assign({},p,n,{render:d})):React.cloneElement(s,{},d)})}},function(e){var t=e.render,r=e.children,n=__rest(e,["render","children"]);return t&&isFn(t)?t(n):r&&isFn(r)&&r(n)})}var Adopt=function(e){function t(t){var r=e.call(this,t)||this;return r.Composed=adopt(t.mapper,r.props.mapProps),r}return __extends(t,e),t.prototype.render=function(){var e=this.props,t=__rest(e,["mapper","mapProps"]);return React.createElement(this.Composed,__assign({},t))},t}(React.Component);exports.adopt=adopt,exports.Adopt=Adopt;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import React from"react";var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);n.length>o;o++)0>t.indexOf(n[o])&&(r[n[o]]=e[n[o]])}return r}var values=Object.values,keys=Object.keys,assign=Object.assign;function omit(e,t){return keys(t).filter(function(t){return-1===e.indexOf(t)}).reduce(function(e,r){return __assign({},e,((n={})[r]=t[r],n));var n},{})}function prop(e,t){return t[e]}var isFn=function(e){return!!e&&"function"==typeof e},isValidRenderProp=function(e){return React.isValidElement(e)||isFn(e)};function adopt(e,t){if(!values(e).some(isValidRenderProp))throw Error("The render props object mapper just accept valid elements as value");var r=keys(e);return r.reduce(function(n,o,i){return function(a){var s=a.children,c=__rest(a,["children"]);return React.createElement(n,__assign({},c),function(n){var a=prop(o,e),p=omit(keys(c),n),u=i===r.length-1,f=function(e){var r,n=assign({},p,((r={})[o]=e,r));return isFn(s)?s(t&&isFn(t)&&u?t(n):n):null};return isFn(a)?React.createElement(a,assign({},c,n,{render:f})):React.cloneElement(a,{},f)})}},function(e){var t=e.children,r=__rest(e,["children"]);return isFn(t)&&t(r)})}var Adopt=function(e){function t(t){var r=e.call(this,t)||this;return r.Composed=adopt(t.mapper,r.props.mapProps),r}return __extends(t,e),t.prototype.render=function(){var e=this.props,t=__rest(e,["mapper","mapProps"]);return React.createElement(this.Composed,__assign({},t))},t}(React.Component);export{adopt,Adopt};
import React from"react";var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};function __extends(e,r){function t(){this.constructor=e}extendStatics(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var __assign=Object.assign||function(e){for(var r,t=1,n=arguments.length;n>t;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e};function __rest(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>r.indexOf(n)&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);n.length>o;o++)0>r.indexOf(n[o])&&(t[n[o]]=e[n[o]])}return t}var values=Object.values,keys=Object.keys,assign=Object.assign;function omit(e,r){return keys(r).filter(function(r){return-1===e.indexOf(r)}).reduce(function(e,t){return __assign({},e,((n={})[t]=r[t],n));var n},{})}function prop(e,r){return r[e]}var isFn=function(e){return!!e&&"function"==typeof e},isValidRenderProp=function(e){return React.isValidElement(e)||isFn(e)};function adopt(e,r){if(!values(e).some(isValidRenderProp))throw Error("The render props object mapper just accept valid elements as value");var t=keys(e);return t.reduce(function(n,o,i){return function(s){var a=s.render,c=s.children,p=__rest(s,["render","children"]);return React.createElement(n,__assign({},p),function(n){var s=prop(o,e),u=omit(keys(p),n),f=i===t.length-1,l=a&&isFn(a)?a:c,d=function(e){var t,n=assign({},u,((t={})[o]=e,t)),i=r&&isFn(r)&&f?r(n):n;return l&&isFn(l)?l(i):null};return isFn(s)?React.createElement(s,assign({},p,n,{render:d})):React.cloneElement(s,{},d)})}},function(e){var r=e.render,t=e.children,n=__rest(e,["render","children"]);return r&&isFn(r)?r(n):t&&isFn(t)&&t(n)})}var Adopt=function(e){function r(r){var t=e.call(this,r)||this;return t.Composed=adopt(r.mapper,t.props.mapProps),t}return __extends(r,e),r.prototype.render=function(){var e=this.props,r=__rest(e,["mapper","mapProps"]);return React.createElement(this.Composed,__assign({},r))},r}(React.Component);export{adopt,Adopt};
//# sourceMappingURL=index.m.js.map

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=_interopDefault(require("react")),extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);n.length>o;o++)0>t.indexOf(n[o])&&(r[n[o]]=e[n[o]])}return r}var values=Object.values,keys=Object.keys,assign=Object.assign;function omit(e,t){return keys(t).filter(function(t){return-1===e.indexOf(t)}).reduce(function(e,r){return __assign({},e,((n={})[r]=t[r],n));var n},{})}function prop(e,t){return t[e]}var isFn=function(e){return!!e&&"function"==typeof e},isValidRenderProp=function(e){return React.isValidElement(e)||isFn(e)};function adopt(e,t){if(!values(e).some(isValidRenderProp))throw Error("The render props object mapper just accept valid elements as value");var r=keys(e);return r.reduce(function(n,o,i){return function(a){var s=a.children,c=__rest(a,["children"]);return React.createElement(n,__assign({},c),function(n){var a=prop(o,e),p=omit(keys(c),n),u=i===r.length-1,f=function(e){var r,n=assign({},p,((r={})[o]=e,r));return isFn(s)?s(t&&isFn(t)&&u?t(n):n):null};return isFn(a)?React.createElement(a,assign({},c,n,{render:f})):React.cloneElement(a,{},f)})}},function(e){var t=e.children,r=__rest(e,["children"]);return isFn(t)&&t(r)})}var Adopt=function(e){function t(t){var r=e.call(this,t)||this;return r.Composed=adopt(t.mapper,r.props.mapProps),r}return __extends(t,e),t.prototype.render=function(){var e=this.props,t=__rest(e,["mapper","mapProps"]);return React.createElement(this.Composed,__assign({},t))},t}(React.Component);exports.adopt=adopt,exports.Adopt=Adopt;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=_interopDefault(require("react")),extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);n.length>o;o++)0>t.indexOf(n[o])&&(r[n[o]]=e[n[o]])}return r}var values=Object.values,keys=Object.keys,assign=Object.assign;function omit(e,t){return keys(t).filter(function(t){return-1===e.indexOf(t)}).reduce(function(e,r){return __assign({},e,((n={})[r]=t[r],n));var n},{})}function prop(e,t){return t[e]}var isFn=function(e){return!!e&&"function"==typeof e},isValidRenderProp=function(e){return React.isValidElement(e)||isFn(e)};function adopt(e,t){if(!values(e).some(isValidRenderProp))throw Error("The render props object mapper just accept valid elements as value");var r=keys(e);return r.reduce(function(n,o,i){return function(s){var a=s.render,c=s.children,p=__rest(s,["render","children"]);return React.createElement(n,__assign({},p),function(n){var s=prop(o,e),u=omit(keys(p),n),f=i===r.length-1,l=a&&isFn(a)?a:c,d=function(e){var r,n=assign({},u,((r={})[o]=e,r)),i=t&&isFn(t)&&f?t(n):n;return l&&isFn(l)?l(i):null};return isFn(s)?React.createElement(s,assign({},p,n,{render:d})):React.cloneElement(s,{},d)})}},function(e){var t=e.render,r=e.children,n=__rest(e,["render","children"]);return t&&isFn(t)?t(n):r&&isFn(r)&&r(n)})}var Adopt=function(e){function t(t){var r=e.call(this,t)||this;return r.Composed=adopt(t.mapper,r.props.mapProps),r}return __extends(t,e),t.prototype.render=function(){var e=this.props,t=__rest(e,["mapper","mapProps"]);return React.createElement(this.Composed,__assign({},t))},t}(React.Component);exports.adopt=adopt,exports.Adopt=Adopt;
//# sourceMappingURL=index.umd.js.map
{
"name": "react-adopt",
"version": "0.4.1",
"version": "0.5.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "umd:main": "dist/index.umd.js",

@@ -139,3 +139,3 @@ :sunglasses: _**React Adopt -**_ Compose render props components like a pro

Sometimes get properties from your mappers can be kind a boring depending how nest is the result from each mapper. To easily avoid deep nested objects or combine your results, you can map the final results into a single object using de `mapProps` function as second parameter.
Sometimes, get properties from your mappers can be kind of boring depending on how nested the result from each mapper. To easily avoid deeply nested objects or combine your results, you can map the final results into a single object using the `mapProps` function as the second parameter.

@@ -142,0 +142,0 @@ ```js

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc