UNPKG

1.21 kBJavaScriptView Raw
1var _Symbol$for = require("../core-js/symbol/for");
2
3var _Symbol = require("../core-js/symbol");
4
5var REACT_ELEMENT_TYPE;
6
7function _createRawReactElement(type, props, key, children) {
8 if (!REACT_ELEMENT_TYPE) {
9 REACT_ELEMENT_TYPE = typeof _Symbol === "function" && _Symbol$for && _Symbol$for("react.element") || 0xeac7;
10 }
11
12 var defaultProps = type && type.defaultProps;
13 var childrenLength = arguments.length - 3;
14
15 if (!props && childrenLength !== 0) {
16 props = {};
17 }
18
19 if (props && defaultProps) {
20 for (var propName in defaultProps) {
21 if (props[propName] === void 0) {
22 props[propName] = defaultProps[propName];
23 }
24 }
25 } else if (!props) {
26 props = defaultProps || {};
27 }
28
29 if (childrenLength === 1) {
30 props.children = children;
31 } else if (childrenLength > 1) {
32 var childArray = new Array(childrenLength);
33
34 for (var i = 0; i < childrenLength; i++) {
35 childArray[i] = arguments[i + 3];
36 }
37
38 props.children = childArray;
39 }
40
41 return {
42 $$typeof: REACT_ELEMENT_TYPE,
43 type: type,
44 key: key === undefined ? null : '' + key,
45 ref: null,
46 props: props,
47 _owner: null
48 };
49}
50
51module.exports = _createRawReactElement;
\No newline at end of file