Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Remove need for full buffer shim (except in test suite)
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed Apr 9, 2021
1 parent 0b5e1a3 commit 8f79234
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions abstract-leveldown.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const supports = require('level-supports')
const Buffer = require('buffer').Buffer
const isBuffer = require('is-buffer')
const AbstractIterator = require('./abstract-iterator')
const AbstractChainedBatch = require('./abstract-chained-batch')
const nextTick = require('./next-tick')
Expand Down Expand Up @@ -301,7 +301,7 @@ AbstractLevelDOWN.prototype._serializeValue = function (value) {
AbstractLevelDOWN.prototype._checkKey = function (key) {
if (key === null || key === undefined) {
return new Error('key cannot be `null` or `undefined`')
} else if (Buffer.isBuffer(key) && key.length === 0) {
} else if (isBuffer(key) && key.length === 0) { // TODO: replace with typed array check
return new Error('key cannot be an empty Buffer')
} else if (key === '') {
return new Error('key cannot be an empty String')
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"buffer": "^6.0.3",
"immediate": "^3.2.3",
"is-buffer": "^2.0.5",
"level-concat-iterator": "^3.0.0",
"level-supports": "^2.0.0"
},
Expand Down

0 comments on commit 8f79234

Please sign in to comment.