function Store(options) { var Adapter = require('./db/' + options.adapter); this.adapter = new Adapter(options[options.adapter]); } // Methods that should be supported by adaptors. var methods = [ 'connect', 'disconnect', 'setBin', 'setBinUser', 'setBinPanel', 'getBin', 'getLatestBin', 'getBinsByUser', 'generateBinId', 'getUser', 'setUser', 'touchLogin', 'updateUserKey' ]; // Proxy the methods through the store. methods.forEach(function (method) { Store.prototype[method] = function () { this.adapter[method].apply(this.adapter, arguments); }; }); module.exports = function createStore(options) { return new Store(options); }; module.exports.Store = Store;