eslint --fix

This commit is contained in:
typicode
2018-05-30 12:47:00 +02:00
parent 4a8d8c80d0
commit 50baa9e640
3 changed files with 20 additions and 24 deletions

View File

@ -53,30 +53,28 @@ module.exports = (source, opts = { foreignKeySuffix: 'Id' }) => {
router.use(nested(opts))
// Create routes
db
.forEach((value, key) => {
if (_.isPlainObject(value)) {
router.use(`/${key}`, singular(db, key))
return
}
db.forEach((value, key) => {
if (_.isPlainObject(value)) {
router.use(`/${key}`, singular(db, key))
return
}
if (_.isArray(value)) {
router.use(`/${key}`, plural(db, key, opts))
return
}
if (_.isArray(value)) {
router.use(`/${key}`, plural(db, key, opts))
return
}
var sourceMessage = ''
if (!_.isObject(source)) {
sourceMessage = `in ${source}`
}
var sourceMessage = ''
if (!_.isObject(source)) {
sourceMessage = `in ${source}`
}
const msg =
`Type of "${key}" (${typeof value}) ${sourceMessage} is not supported. ` +
`Use objects or arrays of objects.`
const msg =
`Type of "${key}" (${typeof value}) ${sourceMessage} is not supported. ` +
`Use objects or arrays of objects.`
throw new Error(msg)
})
.value()
throw new Error(msg)
}).value()
router.use((req, res) => {
if (!res.locals.data) {

View File

@ -299,8 +299,7 @@ module.exports = (db, name, opts) => {
// Remove dependents documents
const removable = db._.getRemovable(db.getState(), opts)
removable.forEach(item => {
db
.get(item.name)
db.get(item.name)
.removeById(item.id)
.value()
})

View File

@ -27,8 +27,7 @@ module.exports = (db, name) => {
if (req.method === 'PUT') {
db.set(name, req.body).value()
} else {
db
.get(name)
db.get(name)
.assign(req.body)
.value()
}