This commit is contained in:
Jeremy Ashkenas
2011-10-24 13:19:15 -04:00
parent b4d9503340
commit 3c54f79113
2 changed files with 5 additions and 0 deletions

View File

@@ -645,6 +645,7 @@
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};