All files / app/codeCharta/ui/ribbonBar/searchPanel/searchBar/utils isPatternBlacklisted.ts

58.82% Statements 10/17
42.85% Branches 3/7
66.66% Functions 2/3
57.14% Lines 8/14

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 13 14 15 16 17 18 19 20 21 22 23  5x   5x 14x 14x                   14x 14x 4x     10x    
import { BlacklistItem, BlacklistType } from "../../../../../codeCharta.model"
import { unifyWildCard } from "./unifyWildCard"
 
export const isPatternBlacklisted = (blacklist: BlacklistItem[], blacklistType: BlacklistType, searchPattern: string) => {
    const paths: string[] = searchPattern.trim().split(",")
    Iif (searchPattern.trim().startsWith("!")) {
        paths[0] = paths[0].slice(1)
        for (const path of paths) {
            const pathNew = `!${unifyWildCard(path)}`
            Iif (blacklist.some(x => pathNew === x.path && blacklistType === x.type)) {
                return true
            }
        }
        return false
    }
    for (const path of paths) {
        if (blacklist.some(x => unifyWildCard(path) === x.path && blacklistType === x.type)) {
            return true
        }
    }
    return false
}