mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Simplify _.clone a little bit.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user