"Fossies" - the Fresh Open Source Software Archive 
Member "cli-1.1260.0/src/lib/check-paths.ts" (4 Dec 2023, 769 Bytes) of package /linux/misc/snyk-cli-1.1260.0.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 {
2 MissingTargetFileError,
3 UnsupportedOptionCombinationError,
4 } from './errors';
5 import { isPathToPackageFile } from './detect';
6 import { Options } from './types';
7
8 // Throw error if user specifies package file name as part of path,
9 // and if user specifies multiple paths and used project-name option.
10 export function checkOSSPaths(paths: string[], options: Options) {
11 let count = 0;
12 for (const path of paths) {
13 if (typeof path === 'string' && isPathToPackageFile(path)) {
14 throw MissingTargetFileError(path);
15 } else if (typeof path === 'string') {
16 if (++count > 1 && options['project-name']) {
17 throw new UnsupportedOptionCombinationError([
18 'multiple paths',
19 'project-name',
20 ]);
21 }
22 }
23 }
24 }