underscore-source 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Underscore
2
2
  module Source
3
- VERSION = "0.4.3"
3
+ VERSION = "0.4.4"
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@
31
31
  if (typeof exports !== 'undefined') exports._ = _;
32
32
 
33
33
  // Current version.
34
- _.VERSION = '0.4.3';
34
+ _.VERSION = '0.4.4';
35
35
 
36
36
  /*------------------------ Collection Functions: ---------------------------*/
37
37
 
@@ -293,7 +293,7 @@
293
293
  // item in an array, or -1 if the item is not included in the array.
294
294
  _.indexOf = function(array, item) {
295
295
  if (array.indexOf) return array.indexOf(item);
296
- for (i=0, l=array.length; i<l; i++) if (array[i] === item) return i;
296
+ for (var i=0, l=array.length; i<l; i++) if (array[i] === item) return i;
297
297
  return -1;
298
298
  };
299
299
 
@@ -399,6 +399,8 @@
399
399
  if (a == b) return true;
400
400
  // One of them implements an isEqual()?
401
401
  if (a.isEqual) return a.isEqual(b);
402
+ // Both are NaN?
403
+ if (_.isNumber(a) && _.isNumber(b) && isNaN(a) && isNaN(b)) return true;
402
404
  // If a is not an object by this point, we can't handle it.
403
405
  if (atype !== 'object') return false;
404
406
  // Nothing else worked, deep compare the contents.
@@ -430,6 +432,16 @@
430
432
  return Object.prototype.toString.call(obj) == '[object Function]';
431
433
  };
432
434
 
435
+ // Is a given value a String?
436
+ _.isString = function(obj) {
437
+ return Object.prototype.toString.call(obj) == '[object String]';
438
+ };
439
+
440
+ // Is a given value a Number?
441
+ _.isNumber = function(obj) {
442
+ return Object.prototype.toString.call(obj) == '[object Number]';
443
+ };
444
+
433
445
  // Is a given variable undefined?
434
446
  _.isUndefined = function(obj) {
435
447
  return typeof obj == 'undefined';
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: underscore-source
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.3
5
+ version: 0.4.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel X. Moore