react-universal-interface
Advanced tools
Comparing version 0.6.0 to 0.6.1
import * as React from 'react'; | ||
export declare const divWrapper: (Comp: any, propName: any, props: any, state: any) => any; | ||
declare const createEnhancer: (Facc: any, prop?: string, wrapper?: (Comp: any, propName: any, props: any, state: any) => React.ComponentElement<any, React.Component<any, any, any>>) => (Comp: any, propName?: any, faccProps?: object) => any; | ||
declare const createEnhancer: (Facc: any, prop?: string, wrapper?: (Comp: any, propName: any, props: any, state: any) => React.CElement<any, React.Component<any, any, any>>) => (Comp: any, propName?: any, faccProps?: object) => any; | ||
export default createEnhancer; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.divWrapper = void 0; | ||
var tslib_1 = require("tslib"); | ||
@@ -9,3 +10,3 @@ var React = tslib_1.__importStar(require("react")); | ||
var _a; | ||
return h(Comp, propName ? tslib_1.__assign((_a = {}, _a[propName] = state, _a), props) : tslib_1.__assign({}, state, props)); | ||
return h(Comp, propName ? tslib_1.__assign((_a = {}, _a[propName] = state, _a), props) : tslib_1.__assign(tslib_1.__assign({}, state), props)); | ||
}; | ||
@@ -12,0 +13,0 @@ exports.divWrapper = function (Comp, propName, props, state) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hookToRenderProp = exports.createEnhancer = exports.render = void 0; | ||
var tslib_1 = require("tslib"); | ||
@@ -4,0 +5,0 @@ var render_1 = tslib_1.__importDefault(require("./render")); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var react_1 = require("react"); | ||
@@ -29,14 +30,8 @@ var isReact16Plus = parseInt(react_1.version.substr(0, react_1.version.indexOf('.'))) > 15; | ||
if (isFn(children)) | ||
return children.apply(void 0, [data].concat(more)); | ||
return children.apply(void 0, tslib_1.__spreadArrays([data], more)); | ||
if (comp) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (!isFn(comp)) { | ||
throw new TypeError('Universal children definition expected "comp" or "component" prop ' + | ||
("to be of a React component type, received typeof \"" + typeof comp + "\".")); | ||
} | ||
} | ||
return react_1.createElement(comp, data); | ||
} | ||
if (children instanceof Array) | ||
return isReact16Plus ? children : react_1.createElement.apply(void 0, ['div', null].concat(children)); | ||
return isReact16Plus ? children : react_1.createElement.apply(void 0, tslib_1.__spreadArrays(['div', null], children)); | ||
if (children && (children instanceof Object)) { | ||
@@ -56,4 +51,3 @@ if (process.env.NODE_ENV !== 'production') { | ||
return children; | ||
Object.assign(children.props, data); | ||
return children; | ||
return react_1.cloneElement(children, Object.assign({}, children.props, data)); | ||
} | ||
@@ -60,0 +54,0 @@ } |
@@ -7,3 +7,3 @@ import * as React from 'react'; | ||
setState<K extends string | number | symbol>(state: any, callback?: () => void): void; | ||
forceUpdate(callBack?: () => void): void; | ||
forceUpdate(callback?: () => void): void; | ||
readonly props: Readonly<any> & Readonly<{ | ||
@@ -33,3 +33,3 @@ children?: React.ReactNode; | ||
setState<K extends string | number | symbol>(state: any, callback?: () => void): void; | ||
forceUpdate(callBack?: () => void): void; | ||
forceUpdate(callback?: () => void): void; | ||
readonly props: Readonly<any> & Readonly<{ | ||
@@ -36,0 +36,0 @@ children?: React.ReactNode; |
{ | ||
"name": "react-universal-interface", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Universal Children Definition for React Components", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -36,11 +36,2 @@ import {createElement as h, cloneElement, version} from 'react'; | ||
if (comp) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (!isFn(comp)) { | ||
throw new TypeError( | ||
'Universal children definition expected "comp" or "component" prop ' + | ||
`to be of a React component type, received typeof "${typeof comp}".` | ||
); | ||
} | ||
} | ||
return h(comp, data); | ||
@@ -70,5 +61,3 @@ } | ||
Object.assign(children.props, data); | ||
return children; | ||
return cloneElement(children, Object.assign({}, children.props, data)); | ||
} | ||
@@ -75,0 +64,0 @@ } |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
4
31360
412