Skip to content

Commit 0f93c20

Browse files
committed
Add option to pass hyperdb instance.
1 parent ec0c2fc commit 0f93c20

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ if (!hyperdb.createReadStream) {
2323
function Graph (storage, key, opts) {
2424
if (!(this instanceof Graph)) return new Graph(storage, key, opts)
2525
events.EventEmitter.call(this)
26-
this.db = hyperdb(storage, key, opts)
26+
if (opts.db) {
27+
this.db = opts.db
28+
}
29+
else {
30+
this.db = hyperdb(storage, key, opts)
31+
}
2732

2833
this.db.on('error', (e) => {
2934
this.emit('error', e)

0 commit comments

Comments
 (0)