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:
christianascone
2018-04-17 00:13:54 +02:00
committed by typicode
parent fbdc8cf6b0
commit 005ed73b92

View File

@ -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)