From b5f0672888fee70376eebc39eddd7ba5f77a6b2d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 15 Oct 2014 22:49:03 -0700 Subject: [PATCH] Fix failing clone tests. --- lodash.js | 2 ++ test/test.js | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index 21cdd992b..bc3ad2edd 100644 --- a/lodash.js +++ b/lodash.js @@ -1508,6 +1508,8 @@ if (result === null) { isDeep = false; result = {}; + } else if (isDeep) { + isDeep = toString.call(result) == objectClass; } } if (!isDeep || result === value) { diff --git a/test/test.js b/test/test.js index 14c1bc4b7..df5d1f800 100644 --- a/test/test.js +++ b/test/test.js @@ -1643,7 +1643,6 @@ _.forOwn(objects, function(object, key) { test('`_.' + methodName + '` should clone ' + key, 2, function() { var actual = func(object); - ok(_.isEqual(actual, object)); if (_.isObject(object)) { @@ -1656,7 +1655,7 @@ _.forOwn(nonCloneable, function(object, key) { test('`_.' + methodName + '` should not clone ' + key, 1, function() { - deepEqual(func(object), {}); + deepEqual(func(object), object && {}); }); });