Skip to content

Commit

Permalink
making NaN check more straightforward, capitalizing to be a more reco…
Browse files Browse the repository at this point in the history
…gnizable
  • Loading branch information
Dominic Barnes committed Jan 7, 2014
1 parent 1963751 commit 8f330eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions index.js
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion test/tests.js
Expand Up @@ -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(){
Expand Down

0 comments on commit 8f330eb

Please sign in to comment.