UNPKG

1.23 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 children: void 0
18 };
19 }
20
21 if (props && defaultProps) {
22 for (var propName in defaultProps) {
23 if (props[propName] === void 0) {
24 props[propName] = defaultProps[propName];
25 }
26 }
27 } else if (!props) {
28 props = defaultProps || {};
29 }
30
31 if (childrenLength === 1) {
32 props.children = children;
33 } else if (childrenLength > 1) {
34 var childArray = new Array(childrenLength);
35
36 for (var i = 0; i < childrenLength; i++) {
37 childArray[i] = arguments[i + 3];
38 }
39
40 props.children = childArray;
41 }
42
43 return {
44 $$typeof: REACT_ELEMENT_TYPE,
45 type: type,
46 key: key === undefined ? null : '' + key,
47 ref: null,
48 props: props,
49 _owner: null
50 };
51}
52
53module.exports = _createRawReactElement;
\No newline at end of file