Skip to content

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bruuuuuuuce committed Oct 12, 2021
1 parent 0b9ec03 commit 74ff6c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ export class Cache {
})
}

private parseGetResponse(resp: cache.cache_client.GetResponse): GetResponse {
private parseGetResponse = (resp: cache.cache_client.GetResponse): GetResponse => {
return {
result: momentoResultConverter(resp.result),
message: resp.message,
body: this.textDecoder.decode(resp.cache_body)
}
}

private parseSetResponse(resp: cache.cache_client.SetResponse): SetResponse {
private parseSetResponse = (resp: cache.cache_client.SetResponse): SetResponse => {
return {
result: momentoResultConverter(resp.result),
message: resp.message
}
}

private ensureValidKey(key: any) {
private ensureValidKey = (key: any) => {
if (!key) {
throw new IllegalArgumentError("key must not be empty")
}
Expand Down
6 changes: 3 additions & 3 deletions src/Momento.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export class Momento {
private readonly cacheEndpoint: string;
private readonly authToken: string;
constructor(authToken: string, endpointOverride?: string) {
const claims = Momento.decodeJwt(authToken);
const claims = this.decodeJwt(authToken);
this.authToken = authToken;
this.interceptors = [authInterceptor(authToken)]
this.controlEndpoint = endpointOverride ? `control.${endpointOverride}` : claims.cp;
this.cacheEndpoint = endpointOverride ? `cache.${endpointOverride}` : claims.c;
this.client = new control.control_client.ScsControlClient(this.controlEndpoint, ChannelCredentials.createSsl())
}

private static decodeJwt(jwt?: string): Claims {
private decodeJwt = (jwt?: string): Claims => {
if(!jwt) {
throw new IllegalArgumentError("malformed auth token")
}
Expand Down Expand Up @@ -65,7 +65,7 @@ export class Momento {
})
}

private validateCachename(name: string) {
private validateCachename = (name: string) => {
if (!name) {
throw new IllegalArgumentError("cache name must not be null")
}
Expand Down

0 comments on commit 74ff6c5

Please sign in to comment.