tools/core/filters/scope.filter.ts

tools/core/filters/scope.filter.ts is a file in Coordination Surface. 22 lines of code and 4 definitions.

export const underRoots = function underRoots(paths: readonly string[], roots: readonly string[]): string[] {
    const out: string[] = [];
    for (const path of paths) {
        for (const root of roots) {
            if (path.startsWith(root)) {
                out.push(path);
                break;
            }
        }
    }
    return out;
};

export const outsideRoots = function outsideRoots(paths: readonly string[], roots: readonly string[]): string[] {
    const excluded = new Set(underRoots(paths, roots));
    const out: string[] = [];
    for (const path of paths) {
        if (!excluded.has(path)) {
            out.push(path);
        }
    }
    return out;
};