fix: replacing instanceof Array checks to Array.isArray because insta… · typeorm/typeorm@b99b4ad
@@ -511,7 +511,7 @@ export class EntityManager {
511511target = 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)
515515return Promise.resolve(entity);
516516517517// execute soft-remove operation
@@ -564,7 +564,7 @@ export class EntityManager {
564564target = 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)
568568return Promise.resolve(entity);
569569570570// execute recover operation
@@ -683,15 +683,15 @@ export class EntityManager {
683683if (criteria === undefined ||
684684criteria === null ||
685685criteria === "" ||
686-(criteria instanceof Array && criteria.length === 0)) {
686+(Array.isArray(criteria) && criteria.length === 0)) {
687687688688return Promise.reject(new Error(`Empty criteria(s) are not allowed for the delete method.`));
689689}
690690691691if (typeof criteria === "string" ||
692692typeof criteria === "number" ||
693693criteria instanceof Date ||
694-criteria instanceof Array) {
694+Array.isArray(criteria)) {
695695696696return this.createQueryBuilder()
697697.softDelete()
@@ -721,15 +721,15 @@ export class EntityManager {
721721if (criteria === undefined ||
722722criteria === null ||
723723criteria === "" ||
724-(criteria instanceof Array && criteria.length === 0)) {
724+(Array.isArray(criteria) && criteria.length === 0)) {
725725726726return Promise.reject(new Error(`Empty criteria(s) are not allowed for the delete method.`));
727727}
728728729729if (typeof criteria === "string" ||
730730typeof criteria === "number" ||
731731criteria instanceof Date ||
732-criteria instanceof Array) {
732+Array.isArray(criteria)) {
733733734734return this.createQueryBuilder()
735735.restore()