jsx.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. "use strict";
  2. exports.__esModule = true;
  3. var _for = require("../core-js/symbol/for");
  4. var _for2 = _interopRequireDefault(_for);
  5. var _symbol = require("../core-js/symbol");
  6. var _symbol2 = _interopRequireDefault(_symbol);
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. exports.default = function () {
  9. var REACT_ELEMENT_TYPE = typeof _symbol2.default === "function" && _for2.default && (0, _for2.default)("react.element") || 0xeac7;
  10. return function createRawReactElement(type, props, key, children) {
  11. var defaultProps = type && type.defaultProps;
  12. var childrenLength = arguments.length - 3;
  13. if (!props && childrenLength !== 0) {
  14. props = {};
  15. }
  16. if (props && defaultProps) {
  17. for (var propName in defaultProps) {
  18. if (props[propName] === void 0) {
  19. props[propName] = defaultProps[propName];
  20. }
  21. }
  22. } else if (!props) {
  23. props = defaultProps || {};
  24. }
  25. if (childrenLength === 1) {
  26. props.children = children;
  27. } else if (childrenLength > 1) {
  28. var childArray = Array(childrenLength);
  29. for (var i = 0; i < childrenLength; i++) {
  30. childArray[i] = arguments[i + 3];
  31. }
  32. props.children = childArray;
  33. }
  34. return {
  35. $$typeof: REACT_ELEMENT_TYPE,
  36. type: type,
  37. key: key === undefined ? null : '' + key,
  38. ref: null,
  39. props: props,
  40. _owner: null
  41. };
  42. };
  43. }();