objectSpread.js 615 B

12345678910111213141516171819
  1. import defineProperty from "./defineProperty.js";
  2. export default function _objectSpread(target) {
  3. for (var i = 1; i < arguments.length; i++) {
  4. var source = arguments[i] != null ? Object(arguments[i]) : {};
  5. var ownKeys = Object.keys(source);
  6. if (typeof Object.getOwnPropertySymbols === 'function') {
  7. ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
  8. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  9. }));
  10. }
  11. ownKeys.forEach(function (key) {
  12. defineProperty(target, key, source[key]);
  13. });
  14. }
  15. return target;
  16. }