I am trying to pass the inquire value from one js page to another js from which I can pass this value to another js file which contain the function and I want to pass same value from one function to another function which also pass the value from one function to another function
but the problem is I can’t pass the value even inside the userDetils
so flow chat be like
index.js -> userDetails.js -> userHandler.js
index.js
const userDetails= require("./userDetails");
module.exports = userValue = async () => {
inquirer
.prompt({
type: "input",
name: "userInput",
message: messages.promptFileName,
validate: (userInput) => {
if (!userInput || userInput.trim() === "") {
console.log("Please insert userInput!");
return false;
}
this.name = userInput;
return true;
},
})
.then(async (answer) => {
await userDetails.run(answer.userInput);
});
};
userDeatils.js
const userHandler= require("./userHandler.js);
class UserDetails extends command{
async run(data){
console.log(data);
// await userHandler.start(data);
// .. other code here
}
}
userHandler.js
class userHandler{
async start(data){
// some code here
this.cmdUser()
.then((msgData) => {
return resolve(msgData);
})
.catch((error) => {
return reject(error.errorMessage);
});
}
async cmdUser(){
return new Promise(async (resolve,reject)=>{
await datacmd.run(data);
})
}
}
how I can pass value from index.js to userHandler.js (datacmd())