"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/lib/monitor/count-total-deps-in-tree.ts" (20 Feb 2024, 372 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 { DepTree } from '../types';
    2 
    3 export function countTotalDependenciesInTree(depTree: DepTree): number {
    4   let count = 0;
    5   if (depTree.dependencies) {
    6     for (const name of Object.keys(depTree.dependencies)) {
    7       const dep = depTree.dependencies[name];
    8       if (dep) {
    9         count += 1 + countTotalDependenciesInTree(dep);
   10       }
   11     }
   12   }
   13   return count;
   14 }