-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
46 lines (42 loc) · 1.33 KB
/
Copy pathutils.js
File metadata and controls
46 lines (42 loc) · 1.33 KB
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
37
38
39
40
41
42
43
44
45
46
// Import Some Built-in Module
import readline from 'node:readline';
import {exit} from "process";
// Show Manu Fanction
/** This function can show oure menu items */
export function allTaskList(){
console.log("=============== Menu Start ===============");
console.log("1. Add Task");
console.log("2. View Tasks");
console.log("3. Search Task");
console.log("4. Update Task Status");
console.log("5. Delete Task");
console.log("6. Exit");
return "=============== Menu End ===============";
};
// Create Input Function For Input.
/** This function can input a value */
export async function input(message = "Input : "){
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
return new Promise((resolve) => {
rl.question(message, (inputData) => {
rl.close();
resolve(inputData);
});
});
};
// Create a dateTime Function.
/** This function can show current time */
export function dateTime(){
const timestamp = Date.now();
const currentDate = new Date(timestamp);
const formattedDate = currentDate.toISOString().split('T')[0];
return formattedDate;
};
// 6. Exit utils function
/** This function can exit from program */
export function programExit(){
exit()
}