-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix(limitTo): do not convert Infinity to NaN #6772
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
I tried creating a template but kept getting an error when updating the ticket. @caitp here's a JSFiddle anyway http://jsfiddle.net/B9Q3q/ |
I'm not sure what the fiddle is for, the "bug" is pretty much confirmed, but the PR needs review, and needs to be cleaned up after the force pushes to master that happened recently. |
it was for the issue template's steps to reproduce field. but ok |
Alright, no worries =) Caitlin Potter On Mar 20, 2014, at 10:30 PM, David Craig notifications@github.com wrote:
|
parseInt(Infinity, 10) will result in NaN, which becomes undesirable when the expected behaviour is to return the entire input. I believe this is possibly useful as a way to toggle input limiting based on certain factors. Closes angular#6771
Looks good to me |
@@ -73,7 +73,8 @@ function limitToFilter(){ | |||
return function(input, limit) { | |||
if (!isArray(input) && !isString(input)) return input; | |||
|
|||
limit = int(limit); | |||
if (Math.abs(Number(limit)) === Infinity) limit = Number(limit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add curly braces for both if and else.
otherwise this looks good. |
Closed by 5dee9e4 |
parseInt(Infinity, 10)
will result inNaN
, which becomes undesirable when theexpected behaviour is to return the entire input.
I believe this is possibly useful as a way to toggle input limiting based on
certain factors.
Closes #6771