mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
reordering the patch for #504
This commit is contained in:
@@ -302,12 +302,12 @@
|
||||
};
|
||||
|
||||
// Safely convert anything iterable into a real, live array.
|
||||
_.toArray = function(iterable) {
|
||||
if (!iterable) return [];
|
||||
if (iterable.toArray && _.isFunction(iterable.toArray)) return iterable.toArray();
|
||||
if (_.isArray(iterable)) return slice.call(iterable);
|
||||
if (_.isArguments(iterable)) return slice.call(iterable);
|
||||
return _.values(iterable);
|
||||
_.toArray = function(obj) {
|
||||
if (!obj) return [];
|
||||
if (_.isArray(obj)) return slice.call(obj);
|
||||
if (_.isArguments(obj)) return slice.call(obj);
|
||||
if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray();
|
||||
return _.values(obj);
|
||||
};
|
||||
|
||||
// Return the number of elements in an object.
|
||||
|
||||
Reference in New Issue
Block a user