mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Underscore 0.5.8, with collection functions that once again work on NodeLists and HTMLCollections
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
// Current version.
|
||||
_.VERSION = '0.5.7';
|
||||
_.VERSION = '0.5.8';
|
||||
|
||||
// ------------------------ Collection Functions: ---------------------------
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
try {
|
||||
if (obj.forEach) {
|
||||
obj.forEach(iterator, context);
|
||||
} else if (_.isArray(obj) || _.isArguments(obj)) {
|
||||
} else if (_.isNumber(obj.length)) {
|
||||
for (var i=0, l=obj.length; i<l; i++) iterator.call(context, obj[i], i, obj);
|
||||
} else {
|
||||
var keys = _.keys(obj), l = keys.length;
|
||||
@@ -152,7 +152,7 @@
|
||||
// Determine if a given value is included in the array or object,
|
||||
// based on '==='.
|
||||
_.include = function(obj, target) {
|
||||
if (_.isArray(obj)) return _.indexOf(obj, target) != -1;
|
||||
if (obj && _.isFunction(obj.indexOf)) return _.indexOf(obj, target) != -1;
|
||||
var found = false;
|
||||
_.each(obj, function(value) {
|
||||
if (found = value === target) _.breakLoop();
|
||||
@@ -400,7 +400,7 @@
|
||||
|
||||
// Retrieve the names of an object's properties.
|
||||
_.keys = function(obj) {
|
||||
if(_.isArray(obj)) return _.range(0, obj.length);
|
||||
if (_.isArray(obj)) return _.range(0, obj.length);
|
||||
var keys = [];
|
||||
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys.push(key);
|
||||
return keys;
|
||||
|
||||
Reference in New Issue
Block a user