Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9375: is_number_not_is_nan.diff

File is_number_not_is_nan.diff, 0.8 kB (added by norbert, 10 months ago)

My first Prototype patch! So proud.

  • test/unit/base.html

    old new  
    246246    testObjectIsNumber: function() { with(this) { 
    247247      assert(Object.isNumber(0)); 
    248248      assert(Object.isNumber(1.0)); 
     249      assert(!Object.isNumber(NaN)); 
    249250      assert(!Object.isNumber(function() { })); 
    250251      assert(!Object.isNumber("a string")); 
    251252      assert(!Object.isNumber([])); 
  • src/base.js

    old new  
    134134  }, 
    135135   
    136136  isNumber: function(object) { 
    137     return typeof object == "number"
     137    return typeof object == "number" && !isNaN(object)
    138138  }, 
    139139   
    140140  isUndefined: function(object) {