Skip to content

Commit 06b46e0

Browse files
committed
feat(jsonView): simplifiy condition
1 parent 714341a commit 06b46e0

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/decorators.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ export function JsonView(params?: {}, method?: string): Function {
6262

6363
descriptor.value = function(...args: any[]) {
6464
let result: any = originalMethod.apply(this, args);
65-
66-
let transformer: Function;
67-
if (typeof method === "string" && method) {
68-
transformer = classTransformer[method];
69-
}
70-
else {
71-
transformer = classTransformer.classToPlain;
72-
}
65+
let transformer: Function = typeof method === "string" && method ? classTransformer[method] : classTransformer.classToPlain;
7366

7467
result = transformer(result, params);
7568
return result;

0 commit comments

Comments
 (0)