Skip to content

Commit b83a14f

Browse files
author
Bradley Compton
committed
replaced instanceof Array with Array.isArray
1 parent c3d0030 commit b83a14f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TransformOperationExecutor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class TransformOperationExecutor {
3535
isMap: boolean,
3636
level: number = 0) {
3737

38-
if (value instanceof Array || value instanceof Set) {
38+
if (Array.isArray(value) || value instanceof Set) {
3939
const newValue = arrayType && this.transformationType === TransformationType.PLAIN_TO_CLASS ? new (arrayType as any)() : [];
4040
(value as any[]).forEach((subValue, index) => {
4141
const subSource = source ? source[index] : undefined;
@@ -145,7 +145,7 @@ export class TransformOperationExecutor {
145145
}
146146

147147
// if value is an array try to get its custom array type
148-
const arrayType = value[valueKey] instanceof Array ? this.getReflectedType(targetType, propertyName) : undefined;
148+
const arrayType = Array.isArray(value[valueKey]) ? this.getReflectedType(targetType, propertyName) : undefined;
149149
// const subValueKey = TransformationType === TransformationType.PLAIN_TO_CLASS && newKeyName ? newKeyName : key;
150150
const subSource = source ? source[valueKey] : undefined;
151151

0 commit comments

Comments
 (0)