From 03b370d500c8669d33f2b007ce2842eb1f481346 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Mon, 21 Oct 2024 23:41:29 +0200 Subject: [PATCH] Remove level-mem compatibility checks Category: removal --- index.js | 10 +--------- test.js | 7 ------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/index.js b/index.js index 661c3b8..c1bee4c 100644 --- a/index.js +++ b/index.js @@ -263,20 +263,12 @@ for (const Ctor of [MemoryIterator, MemoryKeyIterator, MemoryValueIterator]) { } class MemoryLevel extends AbstractLevel { - constructor (location, options, _) { + constructor (location, options) { // Take a dummy location argument to align with other implementations if (typeof location === 'object' && location !== null) { options = location } - // To help migrating from level-mem to abstract-level - // TODO (v2): remove - if (typeof location === 'function' || typeof options === 'function' || typeof _ === 'function') { - throw new ModuleError('The levelup-style callback argument has been removed', { - code: 'LEVEL_LEGACY' - }) - } - let { storeEncoding, ...forward } = options || {} storeEncoding = storeEncoding || 'buffer' diff --git a/test.js b/test.js index e38ccdb..f2540b2 100644 --- a/test.js +++ b/test.js @@ -38,10 +38,3 @@ test('throws on unsupported storeEncoding', function (t) { t.throws(() => new MemoryLevel({ storeEncoding: 'foo' }), (err) => err.code === 'LEVEL_ENCODING_NOT_SUPPORTED') t.end() }) - -test('throws on legacy level-mem options', function (t) { - t.throws(() => new MemoryLevel(() => {}), (err) => err.code === 'LEVEL_LEGACY') - t.throws(() => new MemoryLevel('x', () => {}), (err) => err.code === 'LEVEL_LEGACY') - t.throws(() => new MemoryLevel('x', {}, () => {}), (err) => err.code === 'LEVEL_LEGACY') - t.end() -})