Skip to content

Commit

Permalink
fix potential inspect error in child managers and remove deprecated D…
Browse files Browse the repository at this point in the history
…eno.customInspect usage (#265)
  • Loading branch information
DjDeveloperr authored Nov 14, 2021
1 parent 1834d47 commit e0900ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/managers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class BaseManager<T, T2> extends Base {
return (await this.client.cache.keys(this.cacheName)) ?? []
}

[Deno.customInspect](): string {
[Symbol.for('Deno.customInspect')](): string {
return `Manager(${this.cacheName})`
}
}
6 changes: 4 additions & 2 deletions src/managers/baseChild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export class BaseChildManager<T, T2> extends Base {
}

get cacheName(): string {
return this.parent.cacheName
return typeof this.parent === 'undefined'
? 'unknown_parent'
: this.parent.cacheName
}

async get(key: string): Promise<T2 | undefined> {
Expand Down Expand Up @@ -75,7 +77,7 @@ export class BaseChildManager<T, T2> extends Base {
return this.parent.keys()
}

[Deno.customInspect](): string {
[Symbol.for('Deno.customInspect')](): string {
return `ChildManager(${this.cacheName})`
}
}

0 comments on commit e0900ae

Please sign in to comment.