Switch back to async

This commit is contained in:
typicode
2018-11-14 12:03:05 +01:00
parent 59ef199d16
commit 33fcd7159c

View File

@ -4,7 +4,7 @@ const _ = require('lodash')
const lodashId = require('lodash-id')
const low = require('lowdb')
const Memory = require('lowdb/adapters/Memory')
const FileSync = require('lowdb/adapters/FileSync')
const FileAsync = require('lowdb/adapters/FileAsync')
const bodyParser = require('../body-parser')
const validateData = require('./validate-data')
const plural = require('./plural')
@ -14,7 +14,7 @@ const mixins = require('../mixins')
module.exports = (db, opts = { foreignKeySuffix: 'Id' }) => {
if (typeof db === 'string') {
db = low(new FileSync(db))
db = low(new FileAsync(db))
} else if (!_.has(db, '__chain__') || !_.has(db, '__wrapped__')) {
db = low(new Memory()).setState(db)
}