Merge pull request #203 from RReverser/ctor-spread-speedup
Speed up constructor spreads.
This commit is contained in:
commit
714ca9fbc8
@ -1,5 +1,5 @@
|
||||
(function (Constructor, args) {
|
||||
var bindArgs = [null].concat(args);
|
||||
var Factory = Constructor.bind.apply(Constructor, bindArgs);
|
||||
return new Factory;
|
||||
var instance = Object.create(Constructor);
|
||||
Constructor.apply(instance, args);
|
||||
return instance;
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user