Have the following called library:
var rd = require('redis.dump')
used in function to query the database and do some processing and then return
function query(type, row, column){
var output = []
...
rd({
filter: ...
port : ...
format: ...
},
function(err, result){
[where the processing of result begins]
...
output = [processed result]
...
}
});
return output;
}
How to out async in place to wait until rd finishes and then return output? I tried the following and failed:
function query(type, row, column){
var output = []
...
rd({
filter: ...
port : ...
format: ...
},
async function convert(err, result){
[where the processing of result begins]
...
output = [processed result]
...
}
});
rd.convert.then(return output);
}
with a TypeError:
TypeError: Cannot read property 'then' of undefined
Thanks in advance