"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/packages/snyk-fix/src/partition-by-vulnerable.ts" (20 Feb 2024, 501 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { EntityToFix } from './types';
    2 
    3 export function partitionByVulnerable(
    4   entities: EntityToFix[],
    5 ): { vulnerable: EntityToFix[]; notVulnerable: EntityToFix[] } {
    6   const vulnerable: EntityToFix[] = [];
    7   const notVulnerable: EntityToFix[] = [];
    8 
    9   for (const entity of entities) {
   10     const hasIssues = entity.testResult.issues.length > 0;
   11     if (hasIssues) {
   12       vulnerable.push(entity);
   13     } else {
   14       notVulnerable.push(entity);
   15     }
   16   }
   17 
   18   return { vulnerable, notVulnerable };
   19 }