Remove level-mem compatibility checks · Level/memory-level@8552de5

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -263,20 +263,12 @@ for (const Ctor of [MemoryIterator, MemoryKeyIterator, MemoryValueIterator]) {

263263

}

264264
265265

class MemoryLevel extends AbstractLevel {

266-

constructor (location, options, _) {

266+

constructor (location, options) {

267267

// Take a dummy location argument to align with other implementations

268268

if (typeof location === 'object' && location !== null) {

269269

options = location

270270

}

271271
272-

// To help migrating from level-mem to abstract-level

273-

// TODO (v2): remove

274-

if (typeof location === 'function' || typeof options === 'function' || typeof _ === 'function') {

275-

throw new ModuleError('The levelup-style callback argument has been removed', {

276-

code: 'LEVEL_LEGACY'

277-

})

278-

}

279-
280272

let { storeEncoding, ...forward } = options || {}

281273

storeEncoding = storeEncoding || 'buffer'

282274
Original file line numberDiff line numberDiff line change

@@ -38,10 +38,3 @@ test('throws on unsupported storeEncoding', function (t) {

3838

t.throws(() => new MemoryLevel({ storeEncoding: 'foo' }), (err) => err.code === 'LEVEL_ENCODING_NOT_SUPPORTED')

3939

t.end()

4040

})

41-
42-

test('throws on legacy level-mem options', function (t) {

43-

t.throws(() => new MemoryLevel(() => {}), (err) => err.code === 'LEVEL_LEGACY')

44-

t.throws(() => new MemoryLevel('x', () => {}), (err) => err.code === 'LEVEL_LEGACY')

45-

t.throws(() => new MemoryLevel('x', {}, () => {}), (err) => err.code === 'LEVEL_LEGACY')

46-

t.end()

47-

})