objectSpread.js 873 B

1234567891011121314151617181920212223242526272829
  1. var _Object$getOwnPropertyDescriptor = require("../core-js/object/get-own-property-descriptor");
  2. var _Object$getOwnPropertySymbols = require("../core-js/object/get-own-property-symbols");
  3. var _Object$keys = require("../core-js/object/keys");
  4. var defineProperty = require("./defineProperty");
  5. function _objectSpread(target) {
  6. for (var i = 1; i < arguments.length; i++) {
  7. var source = arguments[i] != null ? arguments[i] : {};
  8. var ownKeys = _Object$keys(source);
  9. if (typeof _Object$getOwnPropertySymbols === 'function') {
  10. ownKeys = ownKeys.concat(_Object$getOwnPropertySymbols(source).filter(function (sym) {
  11. return _Object$getOwnPropertyDescriptor(source, sym).enumerable;
  12. }));
  13. }
  14. ownKeys.forEach(function (key) {
  15. defineProperty(target, key, source[key]);
  16. });
  17. }
  18. return target;
  19. }
  20. module.exports = _objectSpread;