Skip to content

Commit

Permalink
Merge pull request #4 from mobilusoss/issue-3
Browse files Browse the repository at this point in the history
close #3
  • Loading branch information
mohemohe authored Nov 11, 2019
2 parents 7798569 + f4f03af commit f9de151
Show file tree
Hide file tree
Showing 2 changed files with 5,224 additions and 19 deletions.
8 changes: 3 additions & 5 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Database.prototype.initialize = function(cb) {

checkData: function(next) {
if(Object.keys(self.data).length > 0) return next();
self.read(next);
self.read(self, next);
},

setCollection: ['checkData', function(next) {
setCollection: ['checkData', function(data, next) {
async.eachSeries(Object.keys(self.collections), function(key, nextCollection) {
var collection = self.collections[key];
self.registerCollection(key, collection, nextCollection);
Expand Down Expand Up @@ -172,9 +172,7 @@ Database.prototype.write = function(collectionName, cb) {
* @api private
*/

Database.prototype.read = function(cb) {
var self = this;

Database.prototype.read = function(self, cb) {
if(!this.filePath) return cb(new Error('No filePath was configured for this collection'));

var exists = fsx.existsSync(this.filePath);
Expand Down
Loading

0 comments on commit f9de151

Please sign in to comment.