documentcloud/underscore — pull request #1143 by spadgos (2013-06-07 22:02:28+00:00)
Title: A shortcut for a shallow flatten

If calling `_.flatten(x, true)` where `x` is an array containing only other arrays, the entire flatten method can be simplified down to:

```javascript
return concat.apply(output, x);
```

I added a speed test for the shallow flattening, and it works much faster (~20x)

Before optimisation: ~225-230/s
![](http://tinyurl.com/pl52zts)

After optimisation: ~4900/s
![](http://tinyurl.com/qxxau5p)