From 13c9d80a3b2cd4a90e840415460eeae50fbd0e9e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 23 Oct 2014 20:43:49 -0700 Subject: [PATCH] Use the `new` operator to ensure constructors of other realms produce objects of those realms. --- lodash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index 0df0cd832..301b8c510 100644 --- a/lodash.js +++ b/lodash.js @@ -2976,7 +2976,7 @@ function initArrayClone(array, isDeep) { var index = -1, length = array.length, - result = array.constructor(length); + result = new array.constructor(length); if (!isDeep) { while (++index < length) { @@ -3041,7 +3041,7 @@ return new Ctor(object); case regexpClass: - result = Ctor(object.source, reFlags.exec(object)); + result = new Ctor(object.source, reFlags.exec(object)); result.lastIndex = object.lastIndex; } return result;