-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.js
More file actions
36 lines (30 loc) · 931 Bytes
/
helpers.js
File metadata and controls
36 lines (30 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var path = require('path');
var fs = require('fs');
var location = path.resolve('./');
module.exports = {
createDirectory: function (dirName) {
var directoryPath = path.join(location, dirName);
if (!fs.existsSync(directoryPath)) fs.mkdirSync(directoryPath);
},
isValidProjectDirectory: function () {
var indexFile = path.join(location, "index.js");
var bool = fs.existsSync(indexFile);
return bool;
},
toCamelCase: function (name) {
if (name.length > 0) {
return name[0].toLowerCase() + name.substr(1, name.length);
}
},
removeDashes: function (name) {
return name.replace("-", "");
},
resetConsoleColor: function () {
console.log("\x1b[0m");
},
toTitleCase: function (name) {
if (name.length > 0) {
return name[0].toUpperCase() + name.substr(1, name.length);
}
}
}