Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _buildRefinementQueryString(selectedFilters: IRefinementFilter[]): string {
let refinementQueryConditions: string[] = [];
let refinementQueryString: string = null;
// Conditions between values inside a refiner property
const refinementFilters = mapValues(groupBy(selectedFilters, 'FilterName'), (values) => {
const refinementFilter = values.map((filter) => {
return filter.Value.RefinementToken;
});
return refinementFilter.length > 1 ? Text.format('and({0})', refinementFilter) : refinementFilter.toString();
});
mapKeys(refinementFilters, (value, key) => {
refinementQueryConditions.push(key + ':' + value);
});
const conditionsCount = refinementQueryConditions.length;
switch (true) {
// No filters