From 4a4e54479a6eecd916a0e39d400c54bcbba51c31 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 9 Sep 2015 22:10:08 -0700 Subject: [PATCH] Ensure `_.merge` assigns typed arrays directly. [closes #1453] --- lodash.js | 2 +- test/test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index 5f320945c..c149ccbbf 100644 --- a/lodash.js +++ b/lodash.js @@ -2584,7 +2584,7 @@ if (isArray(srcValue) || isTypedArray(srcValue)) { newValue = isArray(oldValue) ? oldValue - : ((isObject(oldValue) && isArrayLike(oldValue)) ? copyArray(oldValue) : []); + : ((isObject(oldValue) && isArrayLike(oldValue)) ? copyArray(oldValue) : srcValue); } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = isArguments(oldValue) diff --git a/test/test.js b/test/test.js index a3c78eb4b..e6292e886 100644 --- a/test/test.js +++ b/test/test.js @@ -12237,7 +12237,7 @@ function Foo() {} - var values = [new Foo, new Boolean, new Date, Foo, new Number, new String, new RegExp], + var values = [new Foo, new Boolean, new Date, Foo, new Number, new String, new RegExp, new (Uint8Array || noop)], expected = _.map(values, _.constant(true)); var actual = _.map(values, function(value) {