Skip to content

Commit

Permalink
Use Map in MockStorageService
Browse files Browse the repository at this point in the history
  • Loading branch information
jantoun-scottlogic committed Aug 6, 2024
1 parent 045e50b commit 4175b32
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { CarbonEstimatorFormComponent } from './carbon-estimator-form.component'
import { StorageService } from '../services/storage.service';

class MockStorageService {
storage: Record<string, string> = {};
storage = new Map<string, string>();

get(key: string): string | null {
return this.storage[key] || null;
return this.storage.get(key) || null;
}

set(key: string, value: string): void {
this.storage[key] = value;
this.storage.set(key, value);
}

removeItem(key: string): void {
delete this.storage[key];
this.storage.delete(key);
}
}

Expand Down

0 comments on commit 4175b32

Please sign in to comment.