mirror of
https://github.com/typicode/json-server.git
synced 2025-08-01 06:34:02 +08:00
Fixed eslint errors in Tests (#728)
* Fix error message construction in index.js The error message in routes creation was not validated by eslint. Now it is accepted as valid and every test runs well. * Fix error message for both latest and 4 node versions
This commit is contained in:

committed by
typicode

parent
fbdc8cf6b0
commit
005ed73b92
@ -65,10 +65,13 @@ module.exports = (source, opts = { foreignKeySuffix: 'Id' }) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sourceMessage = ''
|
||||||
|
if (!_.isObject(source)) {
|
||||||
|
sourceMessage = `in ${source}`
|
||||||
|
}
|
||||||
|
|
||||||
const msg =
|
const msg =
|
||||||
`Type of "${key}" (${typeof value}) ${_.isObject(source)
|
`Type of "${key}" (${typeof value}) ${sourceMessage} is not supported. ` +
|
||||||
? ''
|
|
||||||
: `in ${source}`} is not supported. ` +
|
|
||||||
`Use objects or arrays of objects.`
|
`Use objects or arrays of objects.`
|
||||||
|
|
||||||
throw new Error(msg)
|
throw new Error(msg)
|
||||||
|
Reference in New Issue
Block a user