From 4620eb7b617d3be2de3917e8e0c8ca78be0fab36 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 2 Apr 2012 15:30:12 -0400 Subject: [PATCH] reordering the patch for #504 --- underscore.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/underscore.js b/underscore.js index 12ab9ed68..636865628 100644 --- a/underscore.js +++ b/underscore.js @@ -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.