var getDataFromUrl = function(url) {
rest.get(url).on('complete',function(data) {
if(data instanceof Error) {
console.log("url error");
process.exit(1);
}else {return data};
});
};
when this function (getDataFromUrl) is called by another function it return undefine
what is happing