Skip to content

Commit

Permalink
style: Rename throttler (noun) decorator to throttle (verb)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed May 30, 2020
1 parent 6a21b21 commit 957b40f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './throttle.decorator';
export * from './throttler-storage.interface';
export * from './throttler.decorator';
export * from './throttler.guard';
export * from './throttler.interface';
export * from './throttler.module';
Expand Down
2 changes: 1 addition & 1 deletion src/throttler.decorator.ts → src/throttle.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function setThrottlerMetadata(
Reflect.defineMetadata(THROTTLER_TTL, ttl, target);
}

export const Throttler = (
export const Throttle = (
limit = 20,
ttl = 60,
): ClassDecorator | MethodDecorator => {
Expand Down
11 changes: 11 additions & 0 deletions src/throttler.guard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import { Observable } from 'rxjs';

@Injectable()
export class ThrottlerGuard implements CanActivate {
canActivate(
context: ExecutionContext,
): boolean | Promise<boolean> | Observable<boolean> {
return true;
}
}

0 comments on commit 957b40f

Please sign in to comment.