diff --git a/lib/aggregates.js b/lib/aggregates.js index c294f67..303661e 100644 --- a/lib/aggregates.js +++ b/lib/aggregates.js @@ -4,6 +4,9 @@ var Errors = require('waterline-errors').adapter; + + + /** * Process Aggregates * diff --git a/lib/database.js b/lib/database.js index d40159f..c8c3671 100644 --- a/lib/database.js +++ b/lib/database.js @@ -2,13 +2,14 @@ * Module dependencies */ -var _ = require('lodash'), - fs = require('fs-extra'), - util = require('util'), - async = require('async'), - waterlineCriteria = require('waterline-criteria'), - Aggregate = require('./aggregates'), - Errors = require('waterline-errors').adapter; +var _ = require('lodash'); +var fsx = require('fs-extra'); +var util = require('util'); +var async = require('async'); +var waterlineCriteria = require('waterline-criteria'); +var Aggregate = require('./aggregates'); +var Errors = require('waterline-errors').adapter; + /** * A File-Backed Datastore @@ -158,8 +159,8 @@ Database.prototype.write = function(collectionName, cb) { var schema = this.schema; var counters = this.counters; - fs.createFileSync(this.filePath); - fs.outputJsonSync(self.filePath, { data: data, schema: schema, counters: counters }); + fsx.createFileSync(this.filePath); + fsx.outputJsonSync(self.filePath, { data: data, schema: schema, counters: counters }); cb(); }; @@ -176,10 +177,10 @@ Database.prototype.read = function(cb) { if(!this.filePath) return cb(new Error('No filePath was configured for this collection')); - var exists = fs.existsSync(this.filePath); + var exists = fsx.existsSync(this.filePath); if(!exists) { - fs.createFileSync(this.filePath); + fsx.createFileSync(this.filePath); return cb(null, { data: {}, schema: {}, counters: {} }); } @@ -190,7 +191,7 @@ Database.prototype.read = function(cb) { counters: self.counters }); - var data = fs.readFileSync(this.filePath, { encoding: 'utf8' }); + var data = fsx.readFileSync(this.filePath, { encoding: 'utf8' }); if(!data) return cb(null, { data: {}, schema: {}, counters: {} }); @@ -645,7 +646,7 @@ Database.prototype.enforceUniqueness = function(collectionName, values, pkValueO } } - // Does it look like a "uniqueness violation"? + // Does it look like a 'uniqueness violation'? if (values[attrName] === this.data[collectionName][index][attrName]) { // It isn't actually a uniquness violation if the record diff --git a/package.json b/package.json index 7eb21a6..d3cd25e 100755 --- a/package.json +++ b/package.json @@ -28,10 +28,10 @@ "license": "MIT", "readmeFilename": "README.md", "dependencies": { - "lodash": "~2.4.1", - "waterline-criteria": "~0.11.0", + "lodash": "2.4.1", + "waterline-criteria": "~1.0.0", "waterline-errors": "~0.10.0", - "fs-extra": "~0.8.1", + "fs-extra": "0.8.1", "async": "~0.2.9", "waterline-cursor": "~0.0.5" },