Simplify _.clone a little bit.

This commit is contained in:
Ryan W Tenney
2010-10-05 20:28:23 -04:00
parent faa672ecd9
commit cd7c9ee964

View File

@@ -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.