All files / app/codeCharta/ui/ribbonBar/searchPanel/blacklistPanel createBlacklistItemSelector.ts

100% Statements 13/13
100% Branches 0/0
100% Functions 5/5
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 135x   5x   5x 20x   5x 12x 12x 12x    
import { createSelector } from "@ngrx/store"
import { BlacklistItem, BlacklistType } from "../../../../codeCharta.model"
import { blacklistSelector } from "../../../../state/store/fileSettings/blacklist/blacklist.selector"
 
export const createBlacklistItemSelector = (type: BlacklistType) =>
    createSelector(blacklistSelector, blacklist => _getFilteredAndSortedItems(type, blacklist))
 
export const _getFilteredAndSortedItems = (type: BlacklistType, blacklist: BlacklistItem[]) => {
    const excludedItems = blacklist.filter(item => item.type === type)
    excludedItems.sort((a, b) => a.path.localeCompare(b.path))
    return excludedItems
}