No unneeded empty arrays in transform spread (#6763)
* No unneeded empty arrays in transform spread Since Array.prototype.concat creates a new array from inputs, there's no need to call it from a new empty array ([].concat()). * [fixup] simplify detection of new array
This commit is contained in:
committed by
Henry Zhu
parent
617d35245f
commit
aefbb1380e
@@ -15,7 +15,7 @@ var b = [...a, 'foo'];
|
||||
|
||||
```js
|
||||
var a = [ 'a', 'b', 'c' ];
|
||||
var b = [].concat(a, [ 'foo' ]);
|
||||
var b = a.concat([ 'foo' ]);
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Reference in New Issue
Block a user