diff --git a/src/FeedStore.js b/src/FeedStore.js index 10aa73a..05a51e2 100644 --- a/src/FeedStore.js +++ b/src/FeedStore.js @@ -1,28 +1,31 @@ 'use strict' -const EventStore = require('orbit-db-eventstore') const FeedIndex = require('./FeedIndex') -class FeedStore extends EventStore { - constructor (ipfs, id, dbname, options) { - if(!options) options = {} - if(!options.Index) Object.assign(options, { Index: FeedIndex }) - super(ipfs, id, dbname, options) - this._type = 'feed' - } +const genFeedStore = function(EventStore) { + class FeedStore extends EventStore { + constructor (ipfs, id, dbname, options) { + if(!options) options = {} + if(!options.Index) Object.assign(options, { Index: FeedIndex }) + super(ipfs, id, dbname, options) + this._type = 'feed' + } - remove (hash, options = {}) { - return this.del(hash, options) - } + remove (hash, options = {}) { + return this.del(hash, options) + } - del (hash, options = {}) { - const operation = { - op: 'DEL', - key: null, - value: hash + del (hash, options = {}) { + const operation = { + op: 'DEL', + key: null, + value: hash + } + return this._addOperation(operation, options) } - return this._addOperation(operation, options) } + return FeedStore } -module.exports = FeedStore + +module.exports = genFeedStore