Skip to content

Commit

Permalink
perf(core): optimize reflector
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed Aug 14, 2022
1 parent 6363cbe commit fc2c93b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/services/reflector.service.ts
Expand Up @@ -23,7 +23,7 @@ export class Reflector {
metadataKey: TKey,
target: Type<any> | Function,
): TResult {
return Reflect.getMetadata(metadataKey, target) as TResult;
return Reflect.getMetadata(metadataKey, target);
}

/**
Expand All @@ -38,7 +38,7 @@ export class Reflector {
targets: (Type<any> | Function)[],
): TResult {
return (targets || []).map(target =>
Reflect.getMetadata(metadataKey, target),
this.get(metadataKey, target),
) as TResult;
}

Expand Down Expand Up @@ -86,6 +86,6 @@ export class Reflector {
metadataKey: TKey,
targets: (Type<any> | Function)[],
): TResult {
return this.getAll(metadataKey, targets).find(item => item !== undefined);
return targets.find(target => this.get(metadataKey, target) !== undefined);
}
}

0 comments on commit fc2c93b

Please sign in to comment.