How to use the @microsoft/sp-lodash-subset.groupBy function in @microsoft/sp-lodash-subset

To help you get started, we’ve selected a few @microsoft/sp-lodash-subset examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SharePoint / sp-dev-fx-webparts / samples / react-search-refiners / spfx / src / services / SearchService / SearchService.ts View on Github external
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