mirror of
https://github.com/typicode/json-server.git
synced 2025-07-29 21:23:41 +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
|
||||
}
|
||||
|
||||
var sourceMessage = ''
|
||||
if (!_.isObject(source)) {
|
||||
sourceMessage = `in ${source}`
|
||||
}
|
||||
|
||||
const msg =
|
||||
`Type of "${key}" (${typeof value}) ${_.isObject(source)
|
||||
? ''
|
||||
: `in ${source}`} is not supported. ` +
|
||||
`Type of "${key}" (${typeof value}) ${sourceMessage} is not supported. ` +
|
||||
`Use objects or arrays of objects.`
|
||||
|
||||
throw new Error(msg)
|
||||
|
Reference in New Issue
Block a user