I'm working on a project in JS(Electron,Node.js)that needs to check if a key in the Windows registry is present. Here is my code:
function IsSettedUp() {
regedit.list('HKCU\\SOFTWARE')
.on('data', function (entry) {
//Returns Keys
console.log(entry.data.keys)
//Checks if "WinXSoft" appears in the entry.data.keys array
var key = $.inArray("WinXSoft", entry.data.keys)
console.log(key)
//Returns false if WinXSoft wasn't found
if (key == -1) {
return false
}
//Returns true if WinXSoft was found
else {
return true
}
})
}
//Should be true or false according to the WinXSoft key
var z = IsSettedUp();
console.log(z)
When I create the key and run the code,this is the output:
console.log(entry.data.keys)
outputs Array(42)
.(Expected)
console.log(key)
ouputs 13
(Expected)
console.log(z)
outputs undefined
(???,Should be true)
So yeah,do you guys know how I can fix this?