export function appendLabelToQuery( query: string, label: string, labelValue: string ) { const case1Regexp = new RegExp(`${label}=.+?(\\}|,)`); if (query.match(case1Regexp)) { return query.replace(case1Regexp, `${label}="${labelValue}"$1`); } if (query.indexOf('{}') !== -1) { return query.replace('}', `${label}="${labelValue}"}`); } if (query.indexOf('}') !== -1) { return query.replace('}', `, ${label}="${labelValue}"}`); } console.warn('TODO: handle this case'); return query; }