MCPcopy
hub / github.com/jsdoc/jsdoc / scan

Method scan

lib/jsdoc/src/scanner.js:25–60  ·  view source on GitHub ↗

* Recursively searches the given searchPaths for js files. * @param {Array. } searchPaths * @param {number} [depth] * @fires sourceFileFound

(searchPaths = [], depth = 1, filter)

Source from the content-addressed store, hash-verified

23 * @fires sourceFileFound
24 */
25 scan(searchPaths = [], depth = 1, filter) {
26 let currentFile;
27 let filePaths = [];
28
29 searchPaths.forEach($ => {
30 const filepath = path.resolve( env.pwd, decodeURIComponent($) );
31
32 try {
33 currentFile = fs.statSync(filepath);
34 }
35 catch (e) {
36 logger.error('Unable to find the source file or directory %s', filepath);
37
38 return;
39 }
40
41 if ( currentFile.isFile() ) {
42 filePaths.push(filepath);
43 }
44 else {
45 filePaths = filePaths.concat( fs.ls(filepath, depth) );
46 }
47 });
48
49 filePaths = filePaths.filter($ => filter.isIncluded($));
50
51 filePaths = filePaths.filter($ => {
52 const e = { fileName: $ };
53
54 this.emit('sourceFileFound', e);
55
56 return !e.defaultPrevented;
57 });
58
59 return filePaths;
60 }
61}
62exports.Scanner = Scanner;

Callers 3

cli.jsFile · 0.80
publish.jsFile · 0.80
scanner.jsFile · 0.80

Calls 1

isIncludedMethod · 0.80

Tested by

no test coverage detected