nl_tokens: Check the config for type errors for non - TypeScript users
pl_tokens: function errorCheck ( config ) { var errors = [ ] ; var reqProps = [ 'firestorePath' , 'moduleName' ] ; reqProps . forEach ( function ( prop ) { if ( ! config [ prop ] ) { <mask> . push ( "Missing `" + prop + "` in your module!" ) ; } } ) ; if ( / (\.|\/) / . test ( config . statePropName ) ) { errors . push ( "statePropName must only include letters from [a-z]" ) ; } if ( / \. / . test ( config . moduleName ) ) { errors . push ( "moduleName must only include letters from [a-z] and forward slashes '/'" ) ; } var syncProps = [ 'where' , 'orderBy' , 'fillables' , 'guard' , 'defaultValues' , 'insertHook' , 'patchHook' , 'deleteHook' , 'insertBatchHook' , 'patchBatchHook' , 'deleteBatchHook' ] ; syncProps . forEach ( function ( prop ) { if ( config [ prop ] ) { errors . push ( "We found `" + prop + "` on your module, are you sure this shouldn't be inside a prop called `sync`?" ) ; } } ) ; var serverChangeProps = [ 'modifiedHook' , 'defaultValues' , 'addedHook' , 'removedHook' ] ; serverChangeProps . forEach ( function ( prop ) { if ( config [ prop ] ) { errors . push ( "We found `" + prop + "` on your module, are you sure this shouldn't be inside a prop called `serverChange`?" ) ; } } ) ; var fetchProps = [ 'docLimit' ] ; fetchProps . forEach ( function ( prop ) { if ( config [ prop ] ) { errors . push ( "We found `" + prop + "` on your module, are you sure this shouldn't be inside a prop called `fetch`?" ) ; } } ) ; var numberProps = [ 'docLimit' ] ; numberProps . forEach ( function ( prop ) { var _prop = config . fetch [ prop ] ; if ( ! isNumber ( _prop ) ) errors . push ( "`" + prop + "` should be a Number, but is not." ) ; } ) ; var functionProps = [ 'insertHook' , 'patchHook' , 'deleteHook' , 'insertBatchHook' , 'patchBatchHook' , 'deleteBatchHook' , 'addedHook' , 'modifiedHook' , 'removedHook' ] ; functionProps . forEach ( function ( prop ) { var _prop = ( syncProps . includes ( prop ) ) ? config . sync [ prop ] : config . serverChange [ prop ] ; if ( ! isFunction ( _prop ) ) errors . push ( "`" + prop + "` should be a Function, but is not." ) ; } ) ; var objectProps = [ 'sync' , 'serverChange' , 'defaultValues' , 'fetch' ] ; objectProps . forEach ( function ( prop ) { var _prop = ( prop === 'defaultValues' ) ? config . sync [ prop ] : config [ prop ] ; if ( ! isPlainObject ( _prop ) ) errors . push ( "`" + prop + "` should be an Object, but is not." ) ; } ) ; var stringProps = [ 'firestorePath' , 'firestoreRefType' , 'moduleName' , 'statePropName' ] ; stringProps . forEach ( function ( prop ) { var _prop = config [ prop ] ; if ( ! isString ( _prop ) ) errors . push ( "`" + prop + "` should be a String, but is not." ) ; } ) ; var arrayProps = [ 'where' , 'orderBy' , 'fillables' , 'guard' ] ; arrayProps . forEach ( function ( prop ) { var _prop = config . sync [ prop ] ; if ( ! isArray ( _prop ) ) errors . push ( "`" + prop + "` should be an Array, but is not." ) ; } ) ; if ( errors . length ) { console . group ( '[vuex-easy-firestore] ERRORS:' ) ; console . error ( "Module: " + config . moduleName ) ; errors . forEach ( function ( e ) { return console . error ( ' - ' , e ) ; } ) ; console . groupEnd ( ) ; return false ; } return true ; }