fix constructor spread optimisation - thanks @zloirock
This commit is contained in:
parent
5a96c2e015
commit
e4a3d222d6
@ -1,7 +1,11 @@
|
|||||||
|
# 1.13.1
|
||||||
|
|
||||||
|
* Fix constructor spread optimisation. Thanks [@zloirock](https://github.com/zloirock).
|
||||||
|
|
||||||
# 1.13.0
|
# 1.13.0
|
||||||
|
|
||||||
* Put experimental ES7 features behind a flag `--experimental` and `experimental` option.
|
* Put experimental ES7 features behind a flag `--experimental` and `experimental` option.
|
||||||
* Constructor speed performance increase. Thanks [@RReverser](https://github.com/RReverser).
|
* Constructor spread performance increase. Thanks [@RReverser](https://github.com/RReverser).
|
||||||
* Use `self` instead of `window` in the optional 6to5 runtime. Thanks [@RReverser](https://github.com/RReverser).
|
* Use `self` instead of `window` in the optional 6to5 runtime. Thanks [@RReverser](https://github.com/RReverser).
|
||||||
|
|
||||||
# 1.12.26
|
# 1.12.26
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(function (Constructor, args) {
|
(function (Constructor, args) {
|
||||||
var instance = Object.create(Constructor.prototype);
|
var instance = Object.create(Constructor.prototype);
|
||||||
Constructor.apply(instance, args);
|
var result = Constructor.apply(instance, args);
|
||||||
return instance;
|
return result != null && (typeof result == "object" || typeof result == "function") ? result : instance;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
var _applyConstructor = function (Constructor, args) {
|
var _applyConstructor = function (Constructor, args) {
|
||||||
var instance = Object.create(Constructor.prototype);
|
var instance = Object.create(Constructor.prototype);
|
||||||
|
|
||||||
Constructor.apply(instance, args);
|
var result = Constructor.apply(instance, args);
|
||||||
|
|
||||||
return instance;
|
return result != null && (typeof result == "object" || typeof result == "function") ? result : instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
_applyConstructor(Numbers, Array.from(nums));
|
_applyConstructor(Numbers, Array.from(nums));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user