documentcloud/underscore — pull request #1048 by almost (2013-04-03 15:49:46+00:00)
Title: _.times should tree negative numbers as 0 instead of throwing an error

For example `_.times(0,_.identity)`, `_.times(-1,_.identity)` and `_.times(-100,_.identity)` should all equal `[]`.

I think this is consistent with how `_.range` works and also with how the normal use of `for` loops work. It also means that code like this will work even when arrays equals `[]`:

```
_.times(_.max(_.pluck(arrays, 'length')), _.identity)
```

For a real world example of where this would improve some code see this line from my other PR at https://github.com/documentcloud/underscore/pull/1047#discussion_r3627751

I've also shortened the implementation of `_.times` by writing it in terms of `_.range` and `_.map` which I think is quite nice, can anyone see any downsides?