The pouchDB get document is returning an undefined value
function getVal(db, id) {
if (db == "lvldb") {
lvldb.get(db.toString()).then(function (doc) {
if (id == null) {
return doc;
} else {
return doc[id];
}
});
}
}
There is no error but when I view what the function returns it says undefined