Skip to content

Commit 4a99a5b

Browse files
authored
Merge pull request #165 from Bradcomp/master
replaced instanceof Array with Array.isArray
2 parents 3e4e6ba + b83a14f commit 4a99a5b

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)