mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17: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) {
|
function initArrayClone(array, isDeep) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array.length,
|
length = array.length,
|
||||||
result = array.constructor(length);
|
result = new array.constructor(length);
|
||||||
|
|
||||||
if (!isDeep) {
|
if (!isDeep) {
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
@@ -3041,7 +3041,7 @@
|
|||||||
return new Ctor(object);
|
return new Ctor(object);
|
||||||
|
|
||||||
case regexpClass:
|
case regexpClass:
|
||||||
result = Ctor(object.source, reFlags.exec(object));
|
result = new Ctor(object.source, reFlags.exec(object));
|
||||||
result.lastIndex = object.lastIndex;
|
result.lastIndex = object.lastIndex;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user