Use Object.assign directly and inject object-assign at compile

This commit is contained in:
Paul O’Shannessy
2016-04-04 09:53:25 -07:00
parent b0d1e16271
commit 1573baaee8
45 changed files with 123 additions and 150 deletions
+1 -2
View File
@@ -13,7 +13,6 @@
var PooledClass = require('PooledClass');
var assign = require('Object.assign');
var invariant = require('invariant');
/**
@@ -32,7 +31,7 @@ function CallbackQueue() {
this._contexts = null;
}
assign(CallbackQueue.prototype, {
Object.assign(CallbackQueue.prototype, {
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked.
@@ -11,7 +11,6 @@
'use strict';
var assign = require('Object.assign');
var Transaction;
@@ -46,7 +45,7 @@ describe('Transaction', function() {
this.secondCloseParam = INIT_ERRORED; // WILL be set to something else
this.lastCloseParam = INIT_ERRORED; // WON'T be set to something else
};
assign(TestTransaction.prototype, Transaction.Mixin);
Object.assign(TestTransaction.prototype, Transaction.Mixin);
TestTransaction.prototype.getTransactionWrappers = function() {
return [
{
@@ -97,7 +96,7 @@ describe('Transaction', function() {
this.secondCloseParam = INIT_ERRORED; // WILL be set to something else
this.lastCloseParam = INIT_ERRORED; // WILL be set to something else
};
assign(TestTransaction.prototype, Transaction.Mixin);
Object.assign(TestTransaction.prototype, Transaction.Mixin);
TestTransaction.prototype.getTransactionWrappers = function() {
return [
{
@@ -158,7 +157,7 @@ describe('Transaction', function() {
this.secondCloseParam = INIT_ERRORED; // WILL be set to something else
this.lastCloseParam = INIT_ERRORED; // WILL be set to something else
};
assign(TestTransaction.prototype, Transaction.Mixin);
Object.assign(TestTransaction.prototype, Transaction.Mixin);
// Now, none of the close/inits throw, but the operation we wrap will throw.
TestTransaction.prototype.getTransactionWrappers = function() {
return [
@@ -222,7 +221,7 @@ describe('Transaction', function() {
var TestTransaction = function() {
this.reinitializeTransaction();
};
assign(TestTransaction.prototype, Transaction.Mixin);
Object.assign(TestTransaction.prototype, Transaction.Mixin);
var exceptionMsg = 'This exception should throw.';
TestTransaction.prototype.getTransactionWrappers = function() {
return [
@@ -251,7 +250,7 @@ describe('Transaction', function() {
this.reinitializeTransaction();
this.firstCloseParam = INIT_ERRORED; // WILL be set to something else
};
assign(TestTransaction.prototype, Transaction.Mixin);
Object.assign(TestTransaction.prototype, Transaction.Mixin);
TestTransaction.prototype.getTransactionWrappers = function() {
return [
{
@@ -279,7 +278,7 @@ describe('Transaction', function() {
var NestedTransaction = function() {
this.reinitializeTransaction();
};
assign(NestedTransaction.prototype, Transaction.Mixin);
Object.assign(NestedTransaction.prototype, Transaction.Mixin);
NestedTransaction.prototype.getTransactionWrappers = function() {
return [
{
+1 -2
View File
@@ -11,7 +11,6 @@
'use strict';
var assign = require('Object.assign');
var warning = require('warning');
/**
@@ -48,7 +47,7 @@ function deprecated(fnName, newModule, newPackage, ctx, fn) {
};
// We need to make sure all properties of the original fn are copied over.
// In particular, this is needed to support PropTypes
return assign(newFn, fn);
return Object.assign(newFn, fn);
}
return fn;