objectSpread2.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. var _Object$keys = require("@babel/runtime-corejs3/core-js/object/keys");
  2. var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js/object/get-own-property-symbols");
  3. var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/filter");
  4. var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor");
  5. var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/for-each");
  6. var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptors");
  7. var _Object$defineProperties = require("@babel/runtime-corejs3/core-js/object/define-properties");
  8. var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
  9. var defineProperty = require("./defineProperty.js");
  10. function ownKeys(object, enumerableOnly) {
  11. var keys = _Object$keys(object);
  12. if (_Object$getOwnPropertySymbols) {
  13. var symbols = _Object$getOwnPropertySymbols(object);
  14. if (enumerableOnly) {
  15. symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
  16. return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  17. });
  18. }
  19. keys.push.apply(keys, symbols);
  20. }
  21. return keys;
  22. }
  23. function _objectSpread2(target) {
  24. for (var i = 1; i < arguments.length; i++) {
  25. var source = arguments[i] != null ? arguments[i] : {};
  26. if (i % 2) {
  27. var _context;
  28. _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) {
  29. defineProperty(target, key, source[key]);
  30. });
  31. } else if (_Object$getOwnPropertyDescriptors) {
  32. _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source));
  33. } else {
  34. var _context2;
  35. _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) {
  36. _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
  37. });
  38. }
  39. }
  40. return target;
  41. }
  42. module.exports = _objectSpread2;
  43. module.exports["default"] = module.exports, module.exports.__esModule = true;