fix: replacing instanceof Array checks to Array.isArray because insta… · typeorm/typeorm@b99b4ad

@@ -511,7 +511,7 @@ export class EntityManager {

511511

target = target.options.name;

512512513513

// if user passed empty array of entities then we don't need to do anything

514-

if (entity instanceof Array && entity.length === 0)

514+

if (Array.isArray(entity) && entity.length === 0)

515515

return Promise.resolve(entity);

516516517517

// execute soft-remove operation

@@ -564,7 +564,7 @@ export class EntityManager {

564564

target = target.options.name;

565565566566

// if user passed empty array of entities then we don't need to do anything

567-

if (entity instanceof Array && entity.length === 0)

567+

if (Array.isArray(entity) && entity.length === 0)

568568

return Promise.resolve(entity);

569569570570

// execute recover operation

@@ -683,15 +683,15 @@ export class EntityManager {

683683

if (criteria === undefined ||

684684

criteria === null ||

685685

criteria === "" ||

686-

(criteria instanceof Array && criteria.length === 0)) {

686+

(Array.isArray(criteria) && criteria.length === 0)) {

687687688688

return Promise.reject(new Error(`Empty criteria(s) are not allowed for the delete method.`));

689689

}

690690691691

if (typeof criteria === "string" ||

692692

typeof criteria === "number" ||

693693

criteria instanceof Date ||

694-

criteria instanceof Array) {

694+

Array.isArray(criteria)) {

695695696696

return this.createQueryBuilder()

697697

.softDelete()

@@ -721,15 +721,15 @@ export class EntityManager {

721721

if (criteria === undefined ||

722722

criteria === null ||

723723

criteria === "" ||

724-

(criteria instanceof Array && criteria.length === 0)) {

724+

(Array.isArray(criteria) && criteria.length === 0)) {

725725726726

return Promise.reject(new Error(`Empty criteria(s) are not allowed for the delete method.`));

727727

}

728728729729

if (typeof criteria === "string" ||

730730

typeof criteria === "number" ||

731731

criteria instanceof Date ||

732-

criteria instanceof Array) {

732+

Array.isArray(criteria)) {

733733734734

return this.createQueryBuilder()

735735

.restore()