With 1.9.0 _.first([], 10)
returns undefined
instead of []
.
I think this is a big problem :stuck_out_tongue:
Wow... It almost looks like this was an intended change... https://github.com/jashkenas/underscore/pull/2513
Personally, I think you would expect _.first([], 2)
to be []
following from _.first([1,2,3], 2)
being [1,2]
That does look like a nasty little regression to me — when called with the number of items specified explicitly. Any other opinions? @jridgewell?
That said, it does raise the question of what _.first([], 1)
should be.
Whoops, poor review on my part. Passing in a n
argument should always return an array.
No worries, we can do a 1.9.1 with any other cleanups that arise — plus maybe settling some of the other open PRs...
gracias. this one bit us too today.
This one leads to very obscure bugs in edge cases in lots of various places in a bigger app in my case.
Should it not be a priority?
This one also bit us. Luckily it was caught by some unit tests before we rolled it out live. I'd be grateful for a quick fix.
Alright! Underscore 1.9.1 is now published, with this bugfix in it.
Thanks @jashkenas
Most helpful comment
Alright! Underscore 1.9.1 is now published, with this bugfix in it.