Ticket #10595: Object.isNumber_and_Object.isString.diff
| File Object.isNumber_and_Object.isString.diff, 1.3 kB (added by foca, 7 months ago) |
|---|
-
test/unit/base.html
old new 340 340 testObjectIsString: function() { with(this) { 341 341 assert(!Object.isString(function() { })); 342 342 assert(Object.isString("a string")); 343 assert(Object.isString(new String("something"))); 343 344 assert(!Object.isString(0)); 344 345 assert(!Object.isString([])); 345 346 assert(!Object.isString({})); … … 350 351 testObjectIsNumber: function() { with(this) { 351 352 assert(Object.isNumber(0)); 352 353 assert(Object.isNumber(1.0)); 354 assert(Object.isNumber(new Number(1))); 353 355 assert(!Object.isNumber(function() { })); 354 356 assert(!Object.isNumber("a string")); 355 357 assert(!Object.isNumber([])); -
src/base.js
old new 144 144 }, 145 145 146 146 isString: function(object) { 147 return typeof object == "string" ;147 return typeof object == "string" || object instanceof String; 148 148 }, 149 149 150 150 isNumber: function(object) { 151 return typeof object == "number" ;151 return typeof object == "number" || object instanceof Number; 152 152 }, 153 153 154 154 isUndefined: function(object) {