UNPKG

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