mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Use the new operator to ensure constructors of other realms produce objects of those realms.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user