Skip to content

Commit

Permalink
refactor: warningCache use set
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Oct 20, 2023
1 parent eaadb5d commit 2373235
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export async function findNpm(): Promise<string> {
}

export class WarningsCache {
private static cache: string[] = []
private static cache = new Set<string>()
private static instance: WarningsCache
public static getInstance(): WarningsCache {
if (!WarningsCache.instance) {
Expand All @@ -109,9 +109,7 @@ export class WarningsCache {

public add(...warnings: string[]): void {
for (const warning of warnings) {
if (!WarningsCache.cache.includes(warning)) {
WarningsCache.cache.push(warning)
}
WarningsCache.cache.add(warning)
}
}

Expand Down

0 comments on commit 2373235

Please sign in to comment.