Skip to content

Commit

Permalink
Merge pull request #20 from Microsoft/updateExtends
Browse files Browse the repository at this point in the history
Update extends to use `setPrototypeOf` when available
  • Loading branch information
mhegazy authored Jan 3, 2017
2 parents d0078f4 + b6d3732 commit 09132b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions tslib.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */

var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };

export function __extends(d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
}

export var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
Expand Down
6 changes: 5 additions & 1 deletion tslib.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ var __generator;
}
})
(function (exporter) {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };

__extends = function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
Expand Down

0 comments on commit 09132b3

Please sign in to comment.