@@ -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 ) {
0 commit comments