import { find , keys , get } from 'lodash' ; import { Filter , FILTERS } from '../../../../../common' ; export const mapDefault = ( filter ) => { const metaProperty = /(^\$|meta)/ ; const key = find ( keys ( filter ) , ( item ) => ! item . match ( metaProperty ) ) ; if ( key ) { const type = FILTERS . CUSTOM ; const value = JSON . stringify ( get ( filter , key , { } ) ) ; return { type , key , value } ; } throw filter ; } ;