From cd7c9ee9646bcee3d484f636e5203ba7ea453a4c Mon Sep 17 00:00:00 2001 From: Ryan W Tenney Date: Tue, 5 Oct 2010 20:28:23 -0400 Subject: [PATCH] Simplify `_.clone` a little bit. --- underscore.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/underscore.js b/underscore.js index c81fe1b15..0b4989e68 100644 --- a/underscore.js +++ b/underscore.js @@ -464,8 +464,7 @@ // Create a (shallow-cloned) duplicate of an object. _.clone = function(obj) { - if (_.isArray(obj)) return obj.slice(0); - return _.extend({}, obj); + return _.isArray(obj) ? obj.slice(0) : _.extend({}, obj); }; // Invokes interceptor with the obj, and then returns obj.