MCPcopy
hub / github.com/jmcdo29/testing-nestjs / transform

Method transform

apps/complex-sample/src/cat/cat.pipe.ts:13–28  ·  view source on GitHub ↗
(value: CatDTO, metadata: ArgumentMetadata)

Source from the content-addressed store, hash-verified

11 private errorString = 'Incoming cat is not formated correctly. ';
12
13 transform(value: CatDTO, metadata: ArgumentMetadata) {
14 if (!value.age && typeof value.age !== 'number') {
15 throw new BadRequestException(this.errorString + 'Age must be a number.');
16 }
17 if (!value.name && typeof value.name !== 'string') {
18 throw new BadRequestException(
19 this.errorString + 'Name must be a string.',
20 );
21 }
22 if (!value.breed && typeof value.breed !== 'string') {
23 throw new BadRequestException(
24 this.errorString + 'Breed must be a string.',
25 );
26 }
27 return value;
28 }
29}

Callers 2

cat.pipe.spec.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected