mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
refactor(): move condition to filter function
This commit is contained in:
@@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user