Skip to content

Commit

Permalink
Simplify _.clone a little bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantenney committed Oct 6, 2010
1 parent faa672e commit cd7c9ee
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cd7c9ee

Please sign in to comment.