You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

4 years ago
  1. var REACT_ELEMENT_TYPE;
  2. export default function _createRawReactElement(type, props, key, children) {
  3. if (!REACT_ELEMENT_TYPE) {
  4. REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
  5. }
  6. var defaultProps = type && type.defaultProps;
  7. var childrenLength = arguments.length - 3;
  8. if (!props && childrenLength !== 0) {
  9. props = {
  10. children: void 0
  11. };
  12. }
  13. if (childrenLength === 1) {
  14. props.children = children;
  15. } else if (childrenLength > 1) {
  16. var childArray = new Array(childrenLength);
  17. for (var i = 0; i < childrenLength; i++) {
  18. childArray[i] = arguments[i + 3];
  19. }
  20. props.children = childArray;
  21. }
  22. if (props && defaultProps) {
  23. for (var propName in defaultProps) {
  24. if (props[propName] === void 0) {
  25. props[propName] = defaultProps[propName];
  26. }
  27. }
  28. } else if (!props) {
  29. props = defaultProps || {};
  30. }
  31. return {
  32. $$typeof: REACT_ELEMENT_TYPE,
  33. type: type,
  34. key: key === undefined ? null : '' + key,
  35. ref: null,
  36. props: props,
  37. _owner: null
  38. };
  39. }