refactor: update lowdb and lodash

This commit is contained in:
Typicode
2016-05-08 18:53:43 +02:00
parent 293bac6f73
commit fc08f60898
8 changed files with 63 additions and 49 deletions

View File

@ -136,8 +136,12 @@ module.exports = function (argv) {
if (chunk.trim().toLowerCase() === 's') {
var filename = 'db-' + Date.now() + '.json'
var file = path.join(argv.snapshots, filename)
app.db.saveSync(file)
console.log(' Saved snapshot to ' + path.relative(process.cwd(), file) + '\n')
app
.db
.write(file)
.then(function () {
console.log(' Saved snapshot to ' + path.relative(process.cwd(), file) + '\n')
})
}
})

View File

@ -1,6 +1,7 @@
var path = require('path')
var got = require('got')
var low = require('lowdb')
var fileAsync = require('lowdb/lib/file-async')
var is = require('./is')
module.exports = function (source, cb) {
@ -27,7 +28,7 @@ module.exports = function (source, cb) {
} else if (is.JSON(source)) {
data = low(source).object
data = low(source, { storage: fileAsync }).object
cb(null, data)
} else {