Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.
/ level-js Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var IDB = require('idb-wrapper')
var AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN
var util = require('util')
var Iterator = require('./iterator')
var isBuffer = require('isbuffer')

function Level(location) {
if (!(this instanceof Level)) return new Level(location)
Expand Down Expand Up @@ -67,20 +68,7 @@ Level.prototype._approximateSize = function() {
throw new Error('Not implemented')
}

var isBuffer = Level.prototype._isBuffer = function (buf) {
// TODO is there a better way to check this?
if (buf instanceof ArrayBuffer) return true
if (buf instanceof Int8Array) return true
if (buf instanceof Int16Array) return true
if (buf instanceof Int32Array) return true
if (buf instanceof Uint8Array) return true
if (buf instanceof Uint16Array) return true
if (buf instanceof Uint32Array) return true
if (buf instanceof Uint8ClampedArray) return true
if (buf instanceof Float32Array) return true
if (buf instanceof Float64Array) return true
return false
}
Level.prototype._isBuffer = isBuffer

var checkKeyValue = Level.prototype._checkKeyValue = function (obj, type) {
if (obj === null || obj === undefined)
Expand All @@ -106,4 +94,4 @@ function StringToArrayBuffer(str) {
bufView[i] = str.charCodeAt(i)
}
return buf
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"dependencies": {
"idb-wrapper": "git://github.com/maxogden/IDBWrapper.git#autoContinueOption",
"abstract-leveldown": "~0.3.0",
"levelup": "git://github.com/rvagg/node-levelup.git#0.9-wip"
"levelup": "git://github.com/rvagg/node-levelup.git#0.9-wip",
"isbuffer": "0.0.0"
}
}