underscore-source 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -38,7 +38,7 @@
|
|
38
38
|
propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
39
39
|
|
40
40
|
// Current version.
|
41
|
-
_.VERSION = '0.5.
|
41
|
+
_.VERSION = '0.5.3';
|
42
42
|
|
43
43
|
// ------------------------ Collection Functions: ---------------------------
|
44
44
|
|
@@ -226,7 +226,7 @@
|
|
226
226
|
if (iterable.toArray) return iterable.toArray();
|
227
227
|
if (_.isArray(iterable)) return iterable;
|
228
228
|
if (_.isArguments(iterable)) return slice.call(iterable);
|
229
|
-
return _.
|
229
|
+
return _.values(iterable);
|
230
230
|
};
|
231
231
|
|
232
232
|
// Return the number of elements in an object.
|
@@ -483,7 +483,7 @@
|
|
483
483
|
|
484
484
|
// Is a given value an array?
|
485
485
|
_.isArray = function(obj) {
|
486
|
-
return obj && obj.concat && obj.unshift;
|
486
|
+
return !!(obj && obj.concat && obj.unshift);
|
487
487
|
};
|
488
488
|
|
489
489
|
// Is a given variable an arguments object?
|
@@ -493,12 +493,12 @@
|
|
493
493
|
|
494
494
|
// Is a given value a function?
|
495
495
|
_.isFunction = function(obj) {
|
496
|
-
return obj && obj.constructor && obj.call && obj.apply;
|
496
|
+
return !!(obj && obj.constructor && obj.call && obj.apply);
|
497
497
|
};
|
498
498
|
|
499
499
|
// Is a given value a string?
|
500
500
|
_.isString = function(obj) {
|
501
|
-
return obj === '' || (obj && obj.charCodeAt && obj.substr);
|
501
|
+
return !!(obj === '' || (obj && obj.charCodeAt && obj.substr));
|
502
502
|
};
|
503
503
|
|
504
504
|
// Is a given value a number?
|
@@ -508,12 +508,12 @@
|
|
508
508
|
|
509
509
|
// Is a given value a date?
|
510
510
|
_.isDate = function(obj) {
|
511
|
-
return obj && obj.getTimezoneOffset && obj.setUTCFullYear;
|
511
|
+
return !!(obj && obj.getTimezoneOffset && obj.setUTCFullYear);
|
512
512
|
};
|
513
513
|
|
514
514
|
// Is the given value a regular expression?
|
515
515
|
_.isRegExp = function(obj) {
|
516
|
-
return obj && obj.test && obj.exec && (obj.ignoreCase || obj.ignoreCase === false);
|
516
|
+
return !!(obj && obj.test && obj.exec && (obj.ignoreCase || obj.ignoreCase === false));
|
517
517
|
};
|
518
518
|
|
519
519
|
// Is the given value NaN -- this one is interesting. NaN != NaN, and
|