i have this function that i wrote in typescript and nativescript the value for count is returned from sqlite as promise but not accessible so function alway returns false
checkIfBookmarkAlreadyExist(study_number:string){
this.countInDb=0;
(new Sqlite("sts.db")).then(db => {
this.countInDb=db.get("SELECT count(*) FROM bookmarks WHERE study_number= ?",[study_number] ).then(row => {
return row;
});
});
console.log("value of countInDb ouside: ", this.countInDb);
if(this.countInDb>1){
return true
}else{
return false;
}
}