refactor(): move condition to filter function

This commit is contained in:
Kamil Myśliwiec
2019-05-21 23:03:46 +02:00
parent 4b73ca638e
commit e2f93ef226

View File

@@ -94,11 +94,10 @@ export class ValidationPipe implements PipeTransform<any> {
}
private stripProtoKeys(value: Record<string, any>) {
if (isNil(value)) { return; }
delete value.__proto__;
const keys = Object.keys(value);
keys
.filter(key => typeof value[key] === 'object')
.filter(key => typeof value[key] === 'object' && value[key])
.forEach(key => this.stripProtoKeys(value[key]));
}
}