Skip to content

Commit 50baa9e

Browse files
committed
eslint --fix
1 parent 4a8d8c8 commit 50baa9e

3 files changed

Lines changed: 24 additions & 28 deletions

File tree

src/server/router/index.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,28 @@ module.exports = (source, opts = { foreignKeySuffix: 'Id' }) => {
5353
router.use(nested(opts))
5454

5555
// Create routes
56-
db
57-
.forEach((value, key) => {
58-
if (_.isPlainObject(value)) {
59-
router.use(`/${key}`, singular(db, key))
60-
return
61-
}
62-
63-
if (_.isArray(value)) {
64-
router.use(`/${key}`, plural(db, key, opts))
65-
return
66-
}
67-
68-
var sourceMessage = ''
69-
if (!_.isObject(source)) {
70-
sourceMessage = `in ${source}`
71-
}
72-
73-
const msg =
74-
`Type of "${key}" (${typeof value}) ${sourceMessage} is not supported. ` +
75-
`Use objects or arrays of objects.`
76-
77-
throw new Error(msg)
78-
})
79-
.value()
56+
db.forEach((value, key) => {
57+
if (_.isPlainObject(value)) {
58+
router.use(`/${key}`, singular(db, key))
59+
return
60+
}
61+
62+
if (_.isArray(value)) {
63+
router.use(`/${key}`, plural(db, key, opts))
64+
return
65+
}
66+
67+
var sourceMessage = ''
68+
if (!_.isObject(source)) {
69+
sourceMessage = `in ${source}`
70+
}
71+
72+
const msg =
73+
`Type of "${key}" (${typeof value}) ${sourceMessage} is not supported. ` +
74+
`Use objects or arrays of objects.`
75+
76+
throw new Error(msg)
77+
}).value()
8078

8179
router.use((req, res) => {
8280
if (!res.locals.data) {

src/server/router/plural.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ module.exports = (db, name, opts) => {
299299
// Remove dependents documents
300300
const removable = db._.getRemovable(db.getState(), opts)
301301
removable.forEach(item => {
302-
db
303-
.get(item.name)
302+
db.get(item.name)
304303
.removeById(item.id)
305304
.value()
306305
})

src/server/router/singular.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ module.exports = (db, name) => {
2727
if (req.method === 'PUT') {
2828
db.set(name, req.body).value()
2929
} else {
30-
db
31-
.get(name)
30+
db.get(name)
3231
.assign(req.body)
3332
.value()
3433
}

0 commit comments

Comments
 (0)