Permalink
Browse files

making NaN check more straightforward, capitalizing to be a more reco…

…gnizable
  • Loading branch information...
1 parent 1963751 commit 8f330eb96e694bdd779cd57bbc87a81f389c6eef Dominic Barnes committed Jan 7, 2014
Showing with 2 additions and 15 deletions.
  1. +1 −14 index.js
  2. +1 −1 test/tests.js
View
@@ -22,21 +22,8 @@ module.exports = function(val){
if (val === null) return 'null';
if (val === undefined) return 'undefined';
- if (isNaN(val)) return 'nan';
+ if (val !== val) return 'NaN';
if (val && val.nodeType === 1) return 'element';
return typeof val.valueOf();
};
-
-
-/**
- * Tests whether the input `val` is `NaN`
- *
- * @param {Mixed} val
- * @return {Boolean}
- * @api private
- */
-
-function isNaN(val) {
- return typeof val === "number" && val !== +val;
-}
View
@@ -17,7 +17,7 @@ describe('type', function(){
});
it('should match NaN', function () {
- assert('nan' === type(NaN));
+ assert('NaN' === type(NaN));
});
it('should match strings', function(){

0 comments on commit 8f330eb

Please sign in to comment.