mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
'_.toArray' now checks whether the iterable object contains a 'toArray' method to delegate to.
This commit is contained in:
@@ -217,6 +217,7 @@
|
||||
// Convert anything iterable into a real, live array.
|
||||
_.toArray = function(iterable) {
|
||||
if (!iterable) return [];
|
||||
if (iterable.toArray) return iterable.toArray();
|
||||
if (_.isArray(iterable)) return iterable;
|
||||
return _.map(iterable, function(val){ return val; });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user