-
Notifications
You must be signed in to change notification settings - Fork 99
Fixed negative numbers issue + slightly improved performance #13
Conversation
Thanks for this, great work! I have a couple of questions which I’ll ask inline… Thanks again |
@@ -0,0 +1,2 @@ | |||
.idea |
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.
Out of interest, what is .idea
?
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.
It's Jetbrains project's configuration directory (you know - WebStorm, PHPStorm, PyCharm, IntelliJ Idea, etc). Lot's of people have this and push it by mistake. I thought it would be a good idea (pun not intended) to exclude it to be sure.
So, what do we do with this PR? |
@patrykziem sorry I’ve not got back to you on this one, and thanks for the reminder! Re: isNan: it’d be great if you could implement a Thanks again |
@domchristie done. Is this what you had in mind? |
I changed it to _isNumerical, but I had to change the code you proposed a bit. Since its not about comparing string to a number that gives as the answer. It's turning string into number and then checking whether its NaN. |
Great, thanks! |
Fixed negative numbers issue + slightly improved performance
Released in 0.6.0 |
Hello,
Negative numbers were converted to their absolute values since dash sign was present (and thus removed). It may look hacky but as far as I know it is the most efficient way to check whether string is a number since NaN !== NaN.
I also changed first character conversion to uppercase or lowercase. It uses substr function instead of regexp which makes it a lot faster (jsPerf). I had a huge object to convert and humps began to hurt.
Tests updated accordingly.