MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / getJsFiles

Function getJsFiles

examples/runner.js:14–31  ·  view source on GitHub ↗

List all js files in the directory

(dir, fileArray)

Source from the content-addressed store, hash-verified

12
13/** List all js files in the directory */
14function getJsFiles(dir, fileArray) {
15 const files = fs.readdirSync(dir);
16 fileArray = fileArray || [];
17 files.forEach(function(file) {
18 if (file === 'node_modules') {
19 return;
20 }
21 if (fs.statSync(dir + file).isDirectory()) {
22 getJsFiles(dir + file + '/', fileArray);
23 return;
24 }
25 if (file.substring(file.length-3, file.length) !== '.js') {
26 return;
27 }
28 fileArray.push(dir+file);
29 });
30 return fileArray;
31}
32
33if (+process.versions.node.split('.')[0] < 10) {
34 console.log('Examples were not executed as they were designed to run against Node.js 10+');

Callers 1

runner.jsFile · 0.85

Calls 2

forEachMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected