babel/lib/6to5/transformation/templates/apply-constructor.js
2014-12-29 01:24:35 +11:00

6 lines
248 B
JavaScript

(function (Constructor, args) {
var instance = Object.create(Constructor.prototype);
var result = Constructor.apply(instance, args);
return result != null && (typeof result == "object" || typeof result == "function") ? result : instance;
});