UNPKG

pinkydb

Version:

tiny in-process documents storage for node.js with mongodb like queries

24 lines (18 loc) 428 B
'use strict'; var utils = require('./utils'), Db = require('./db').Db; function Client() { this.dbs = {}; } Client.prototype.open = function(params, callback) { callback = callback || utils.noop; this.params = params; callback(null, this); }; Client.prototype.db = function(name) { if (name in this.dbs === false) { this.dbs[name] = new Db(name, this.params); } return this.dbs[name]; }; exports.Client = Client;