Fix object spread according to spec (#7034)
This commit is contained in:
committed by
Justin Ridgewell
parent
e732ee0c5b
commit
ee6dfd1580
@@ -1 +1,7 @@
|
||||
({ x, ...y, a, ...b, c });
|
||||
|
||||
({ ...Object.prototype });
|
||||
|
||||
({ ...{ foo: 'bar' } });
|
||||
|
||||
({ ...{ get foo () { return 'foo' } } });
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
||||
|
||||
_extends({
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
_objectSpread({
|
||||
x
|
||||
}, y, {
|
||||
a
|
||||
}, b, {
|
||||
c
|
||||
});
|
||||
|
||||
_objectSpread({}, Object.prototype);
|
||||
|
||||
_objectSpread({}, {
|
||||
foo: 'bar'
|
||||
});
|
||||
|
||||
_objectSpread({}, {
|
||||
get foo() {
|
||||
return 'foo';
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user