_object_spread_props.js 970 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = _objectSpreadProps;
  6. function _objectSpreadProps(target, source) {
  7. source = source != null ? source : {};
  8. if (Object.getOwnPropertyDescriptors) {
  9. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  10. } else {
  11. ownKeys(Object(source)).forEach(function(key) {
  12. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  13. });
  14. }
  15. return target;
  16. }
  17. function ownKeys(object, enumerableOnly) {
  18. var keys = Object.keys(object);
  19. if (Object.getOwnPropertySymbols) {
  20. var symbols = Object.getOwnPropertySymbols(object);
  21. if (enumerableOnly) {
  22. symbols = symbols.filter(function(sym) {
  23. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  24. });
  25. }
  26. keys.push.apply(keys, symbols);
  27. }
  28. return keys;
  29. }