objectSpread.js 1.3 KB

12345678910111213141516171819202122232425262728
  1. import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
  2. import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
  3. import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
  4. import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
  5. import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
  6. import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
  7. import defineProperty from "./defineProperty.js";
  8. export default function _objectSpread(target) {
  9. for (var i = 1; i < arguments.length; i++) {
  10. var source = arguments[i] != null ? Object(arguments[i]) : {};
  11. var ownKeys = _Object$keys(source);
  12. if (typeof _Object$getOwnPropertySymbols === 'function') {
  13. var _context;
  14. ownKeys = _concatInstanceProperty(ownKeys).call(ownKeys, _filterInstanceProperty(_context = _Object$getOwnPropertySymbols(source)).call(_context, function (sym) {
  15. return _Object$getOwnPropertyDescriptor(source, sym).enumerable;
  16. }));
  17. }
  18. _forEachInstanceProperty(ownKeys).call(ownKeys, function (key) {
  19. defineProperty(target, key, source[key]);
  20. });
  21. }
  22. return target;
  23. }