import { parse , stringify } from 'query-string' ; import { url } from '../../../../../src/plugins/kibana_utils/public' ; export function toQuery ( search ? ) { return search ? parse ( search . slice ( 1 ) , { sort : false } ) : { } ; } export function fromQuery ( query ) { const encodedQuery = url . encodeQuery ( query , ( value ) => encodeURIComponent ( value ) . replace ( /%3A/g , ':' ) ) ; return stringify ( encodedQuery , { sort : false , encode : false } ) ; }