param objectFields export const parseObjectValue = ( objectFields ) : any => { return objectFields . map ( ( field ) => { const { name , value } = field ; if ( value . kind === 'IntValue' ) value . value = parseInt ( value . value ) ; if ( value . kind === 'ListValue' ) { var itemList = [ ] ; value . values . forEach ( ( e ) => { itemList . push ( e . value ) ; } ) ; return { key : name . value , value : itemList , } ; } return { key : name . value , value : value . value , } ; } ) ; } ; param collectionQuery param where export const setQueryFilters = ( collectionQuery , where ) : firebase . default . firestore . Query => { where . forEach ( ( filter ) => { const key = filter [ 'key' ] ; const value = filter [ 'value' ] ; const splitKey = key . split ( '_' ) ; const whereOp = splitKey [ splitKey . length - 1 ] ; const actualKey = key . slice ( 0 , - 1 * ( whereOp . length + 1 ) ) ; switch ( whereOp ) { case 'eq' : collectionQuery = collectionQuery . where ( actualKey , '==' , value ) ; break ; case 'neq' : collectionQuery = collectionQuery . where ( actualKey , '!=' , value ) ; break ; case 'gt' : collectionQuery = collectionQuery . where ( actualKey , '>' , value ) ; break ; case 'gte' : collectionQuery = collectionQuery . where ( actualKey , '>=' , value ) ; break ; case 'lt' : collectionQuery = collectionQuery . where ( actualKey , '<' , value ) ; break ; case 'lte' : collectionQuery = collectionQuery . where ( actualKey , '<=' , value ) ; break ; case 'contains' : collectionQuery = collectionQuery . where ( actualKey , 'array-contains' , value ) ; break ; case 'containsAny' : collectionQuery = collectionQuery . where ( actualKey , 'array-contains-any' , value ) ; break ; case 'in' : collectionQuery = collectionQuery . where ( actualKey , 'in' , value ) ; break ; case 'notIn' : collectionQuery = collectionQuery . where ( actualKey , 'not-in' , value ) ; break ; default : collectionQuery = collectionQuery . where ( key , '==' , value ) ; break ; } } ) ; return collectionQuery ; } ;