mirror of
https://github.com/typicode/json-server.git
synced 2025-07-31 14:12:38 +08:00
fix lint errors
This commit is contained in:
@ -14,7 +14,7 @@ function prettyPrint(argv, object, rules) {
|
||||
|
||||
console.log()
|
||||
console.log(chalk.bold(' Resources'))
|
||||
for (let prop in object) {
|
||||
for (const prop in object) {
|
||||
console.log(` ${root}/${prop}`)
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ function createApp(db, routes, middlewares, argv) {
|
||||
|
||||
const { foreignKeySuffix } = argv
|
||||
|
||||
let router = jsonServer.router(
|
||||
const router = jsonServer.router(
|
||||
db,
|
||||
foreignKeySuffix ? { foreignKeySuffix } : undefined
|
||||
)
|
||||
@ -138,9 +138,7 @@ module.exports = function(argv) {
|
||||
if (error.errno === 'EADDRINUSE')
|
||||
console.log(
|
||||
chalk.red(
|
||||
`Cannot bind to the port ${
|
||||
error.port
|
||||
}. Please specify another port number either through --port argument or through the json-server.json configuration file`
|
||||
`Cannot bind to the port ${error.port}. Please specify another port number either through --port argument or through the json-server.json configuration file`
|
||||
)
|
||||
)
|
||||
else console.log('Some error occurred', error)
|
||||
|
@ -62,7 +62,7 @@ function deepQuery(value, q) {
|
||||
}
|
||||
}
|
||||
} else if (_.isObject(value) && !_.isArray(value)) {
|
||||
for (let k in value) {
|
||||
for (const k in value) {
|
||||
if (_.deepQuery(value[k], q)) {
|
||||
return true
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ module.exports = (db, name, opts) => {
|
||||
let _start = req.query._start
|
||||
let _end = req.query._end
|
||||
let _page = req.query._page
|
||||
let _sort = req.query._sort
|
||||
let _order = req.query._order
|
||||
const _sort = req.query._sort
|
||||
const _order = req.query._order
|
||||
let _limit = req.query._limit
|
||||
let _embed = req.query._embed
|
||||
let _expand = req.query._expand
|
||||
const _embed = req.query._embed
|
||||
const _expand = req.query._expand
|
||||
delete req.query.q
|
||||
delete req.query._start
|
||||
delete req.query._end
|
||||
@ -76,7 +76,7 @@ module.exports = (db, name, opts) => {
|
||||
// in the database
|
||||
Object.keys(req.query).forEach(query => {
|
||||
const arr = db.get(name).value()
|
||||
for (let i in arr) {
|
||||
for (const i in arr) {
|
||||
if (
|
||||
_.has(arr[i], query) ||
|
||||
query === 'callback' ||
|
||||
@ -100,7 +100,7 @@ module.exports = (db, name, opts) => {
|
||||
q = q.toLowerCase()
|
||||
|
||||
chain = chain.filter(obj => {
|
||||
for (let key in obj) {
|
||||
for (const key in obj) {
|
||||
const value = obj[key]
|
||||
if (db._.deepQuery(value, q)) {
|
||||
return true
|
||||
|
Reference in New Issue
Block a user