diff --git a/src/did/manager.js b/src/did/manager.js index 1fea1b2f1..71aa3167a 100644 --- a/src/did/manager.js +++ b/src/did/manager.js @@ -18,8 +18,8 @@ export class DidManager { return this.#store.get(id); } - async remove(id) { - this.#store.remove(id); + async delete(id) { + this.#store.delete(id); } async set(id, value) { diff --git a/src/did/web5-did.js b/src/did/web5-did.js index 47faae540..ab01f044f 100644 --- a/src/did/web5-did.js +++ b/src/did/web5-did.js @@ -45,7 +45,7 @@ export class Web5Did { clear: () => this.#didManager.clear(), exists: (...args) => this.#didManager.exists(...args), get: (...args) => this.#didManager.get(...args), - remove: (...args) => this.#didManager.remove(...args), + delete: (...args) => this.#didManager.delete(...args), set: (...args) => this.#didManager.set(...args), }; } diff --git a/src/storage/local-storage.js b/src/storage/local-storage.js index 1a86ba858..84ef90262 100644 --- a/src/storage/local-storage.js +++ b/src/storage/local-storage.js @@ -9,7 +9,7 @@ export class LocalStorage extends Storage { localStorage.setItem(key, JSON.stringify(value)); } - async remove(key) { + async delete(key) { localStorage.removeItem(key); } diff --git a/src/storage/memory-storage.js b/src/storage/memory-storage.js index f71851f20..3b15808f2 100644 --- a/src/storage/memory-storage.js +++ b/src/storage/memory-storage.js @@ -13,13 +13,13 @@ export class MemoryStorage extends Storage { if (Number.isFinite(options?.timeout)) { const timeout = setTimeout(() => { - this.remove(key); + this.delete(key); }, options.timeout); this.#timeoutForKey.set(key, timeout); } } - async remove(key) { + async delete(key) { this.#dataForKey.delete(key); clearTimeout(this.#timeoutForKey.get(key)); diff --git a/src/storage/storage.js b/src/storage/storage.js index 604a59c2c..0862faed8 100644 --- a/src/storage/storage.js +++ b/src/storage/storage.js @@ -7,7 +7,7 @@ export class Storage { throw 'subclass must override'; } - async remove(_key) { + async delete(_key) { throw 'subclass must override'; } diff --git a/tests/storage/memory-storage.spec.js b/tests/storage/memory-storage.spec.js index 2c3fbf4b6..9d41edbc0 100644 --- a/tests/storage/memory-storage.spec.js +++ b/tests/storage/memory-storage.spec.js @@ -57,14 +57,14 @@ describe('MemoryStorage', async () => { expect(valueInCache).to.equal('bValue'); }); - it('should remove specified entry', async () => { + it('should delete specified entry', async () => { const storage = new MemoryStorage(); await storage.set('key1', 'aValue'); await storage.set('key2', 'aValue'); await storage.set('key3', 'aValue'); - await storage.remove('key1'); + await storage.delete('key1'); let valueInCache = await storage.get('key1'); expect(valueInCache).to.be.undefined; @@ -72,7 +72,7 @@ describe('MemoryStorage', async () => { expect(valueInCache).to.equal('aValue'); }); - it('should remove all entries after `clear()`', async () => { + it('should delete all entries after `clear()`', async () => { const storage = new MemoryStorage(); await storage.set('key1', 'aValue');