Passed
Pull Request — master (#26)
by Inumidun
01:21
created

lib/baseDir.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 20
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 0
c 1
b 0
f 1
nc 1
dl 0
loc 20
rs 10
wmc 4
mnd 1
bc 5
fnc 3
bpm 1.6666
cpm 1.3333
noi 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A module.exports.getCurrentDirectoryBase 0 3 1
A module.exports.directoryExists 0 7 2
A module.exports.getCurrentWorkingDir 0 3 1
1
const fs = require('fs');
2
const path = require('path');
3
4
module.exports = {
5
  getCurrentDirectoryBase() {
6
    return path.basename(process.cwd());
7
  },
8
9
  getCurrentWorkingDir() {
10
    return process.cwd();
11
  },
12
13
  directoryExists(filePath) {
14
    try {
15
      return fs.statSync(filePath).isDirectory();
16
    } catch (err) {
17
      return false;
18
    }
19
  }
20
};
21